hedgewars/uGearsHandlersMess.pas
changeset 15033 20c80919d97d
parent 14998 fd29c23ff95e
child 15043 01bb1d7ca14f
--- a/hedgewars/uGearsHandlersMess.pas	Tue May 21 16:45:16 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Wed May 22 10:45:35 2019 +0200
@@ -2401,7 +2401,7 @@
         doStepCase(Gear)
     else
         // health texture (FlightTime = health when the last texture was generated)
-        if Gear^.Health <> Gear^.FlightTime then
+        if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
             begin
             Gear^.FlightTime:= Gear^.Health;
             FreeAndNilTexture(Gear^.Tex);
@@ -2479,7 +2479,7 @@
         dec(Gear^.Health, Gear^.Damage);
         Gear^.Damage := 0;
         // health texture (FlightTime = health when the last texture was generated)
-        if Gear^.Health <> Gear^.FlightTime then
+        if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
             begin
             Gear^.FlightTime:= Gear^.Health;
             FreeAndNilTexture(Gear^.Tex);
@@ -2507,7 +2507,7 @@
                     i:= 1;
                 if i = 1 then
                     begin
-                    if Gear^.Health <> Gear^.FlightTime then
+                    if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then
                         begin
                         Gear^.FlightTime:= Gear^.Health;
                         FreeAndNilTexture(Gear^.Tex);
@@ -2516,7 +2516,7 @@
                     end
                 else
                     begin
-                    if Gear^.FlightTime <> $ffffffff then
+                    if (Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil) then
                         begin
                         Gear^.FlightTime:= $ffffffff;
                         FreeAndNilTexture(Gear^.Tex);