hedgewars/uLandTexture.pas
changeset 10634 35d059bd0932
parent 10494 0eb97cf4c78e
child 10648 75498cfe6267
--- a/hedgewars/uLandTexture.pas	Sun Dec 07 14:36:28 2014 -0500
+++ b/hedgewars/uLandTexture.pas	Mon Dec 08 09:35:14 2014 -0500
@@ -169,10 +169,7 @@
                         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEXSIZE, TEXSIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pixels(x,y));
                         end
                     else if tex <> nil then
-                        begin
-                        FreeTexture(tex);
-                        tex:= nil
-                        end;
+                        FreeAndNilTexture(tex);
 
                     // nothing else to do
                     if dirtyLandTexCount < 1 then
@@ -284,13 +281,8 @@
     for x:= 0 to LANDTEXARW - 1 do
         for y:= 0 to LANDTEXARH - 1 do
             with LandTextures[x, y] do
-                begin
                 if tex <> nil then
-                    begin
-                    FreeTexture(tex);
-                    tex:= nil
-                    end
-                end;
+                    FreeAndNilTexture(tex)
 end;
 
 procedure freeModule;