hedgewars/uGearsHandlersMess.pas
changeset 10634 35d059bd0932
parent 10597 9374770c3485
child 10642 8fdfa2b77d83
--- a/hedgewars/uGearsHandlersMess.pas	Sun Dec 07 14:36:28 2014 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Dec 08 09:35:14 2014 -0500
@@ -3645,7 +3645,7 @@
         begin
         Gear^.Damage:= i;
         //AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate);
-        FreeTexture(Gear^.Tex);
+        FreeAndNilTexture(Gear^.Tex);
         Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + '%'), cWhiteColor, fntSmall)
         end;
 
@@ -4805,7 +4805,7 @@
         if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
             begin
             Gear^.Damage:= i;
-            FreeTexture(Gear^.Tex);
+            FreeAndNilTexture(Gear^.Tex);
             Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) +
                          '%'), cWhiteColor, fntSmall)
             end
@@ -4882,7 +4882,7 @@
         if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
             begin
             Gear^.Damage:= i;
-            FreeTexture(Gear^.Tex);
+            FreeAndNilTexture(Gear^.Tex);
             Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) +
                          '%'), cWhiteColor, fntSmall)
             end
@@ -5487,7 +5487,7 @@
     if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then
     begin
     Gear^.Damage:= t;
-    FreeTexture(Gear^.Tex);
+    FreeAndNilTexture(Gear^.Tex);
     Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(t) +
               '%'), cWhiteColor, fntSmall)
     end;