hedgewars/uScript.pas
changeset 10634 35d059bd0932
parent 10618 7b72cf27cd04
child 10660 79fa79c77c38
--- a/hedgewars/uScript.pas	Sun Dec 07 14:36:28 2014 -0500
+++ b/hedgewars/uScript.pas	Mon Dec 08 09:35:14 2014 -0500
@@ -1069,16 +1069,16 @@
                 hh:= team^.Hedgehogs[j];
                 if (hh.Gear <> nil) or (hh.GearHidden <> nil) then
                     begin
-                    FreeTexture(hh.NameTagTex);
+                    FreeAndNilTexture(hh.NameTagTex);
                     hh.NameTagTex:= RenderStringTex(ansistring(hh.Name), clan^.Color, fnt16);
                     RenderHealth(hh);
                     end;
                 end;
-            FreeTexture(team^.NameTagTex);
+            FreeAndNilTexture(team^.NameTagTex);
             team^.NameTagTex:= RenderStringTex(ansistring(clan^.Teams[i]^.TeamName), clan^.Color, fnt16);
             end;
 
-	FreeTexture(clan^.HealthTex);
+	    FreeAndNilTexture(clan^.HealthTex);
         clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, clan^.Teams[0]^.NameTagTex^.h, clan^.Color);
         end;
 
@@ -1111,7 +1111,7 @@
             begin
             gear^.Hedgehog^.Team^.TeamName := lua_tostring(L, 2);
 
-            FreeTexture(gear^.Hedgehog^.Team^.NameTagTex);
+            FreeAndNilTexture(gear^.Hedgehog^.Team^.NameTagTex);
             gear^.Hedgehog^.Team^.NameTagTex:= RenderStringTex(ansistring(gear^.Hedgehog^.Team^.TeamName), gear^.Hedgehog^.Team^.Clan^.Color, fnt16);
             end
         else
@@ -1150,7 +1150,7 @@
             begin
             gear^.Hedgehog^.Name:= lua_tostring(L, 2);
 
-            FreeTexture(gear^.Hedgehog^.NameTagTex);
+            FreeAndNilTexture(gear^.Hedgehog^.NameTagTex);
             gear^.Hedgehog^.NameTagTex:= RenderStringTex(ansistring(gear^.Hedgehog^.Name), gear^.Hedgehog^.Team^.Clan^.Color, fnt16)
             end
         end;