hedgewars/uGearsHandlersMess.pas
changeset 9385 dca86192d773
parent 9362 c9fdf8a3baf0
child 9470 9ed07a96349d
--- a/hedgewars/uGearsHandlersMess.pas	Fri Aug 02 00:06:44 2013 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Tue Aug 13 00:12:11 2013 -0400
@@ -1432,6 +1432,13 @@
     if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then
         dec(TurnTimeLeft);
 
+    if Gear^.Hedgehog^.Gear = nil then
+        begin
+        DeleteGear(Gear);
+        AfterAttack;
+        exit
+        end;
+
     HHGear := Gear^.Hedgehog^.Gear;
 
     HedgehogChAngle(HHGear);
@@ -1493,13 +1500,13 @@
         end;
 
     if b then
-    begin
+        begin
         DrawTunnel(HHGear^.X + Gear^.dX * cHHRadius,
         HHGear^.Y + Gear^.dY * cHHRadius - _1 -
         ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7),
         Gear^.dX, Gear^.dY,
         cHHStepTicks, cHHRadius * 2 + 7);
-    end;
+        end;
 
     if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
     or ((HHGear^.Message and gmAttack) <> 0) then