hedgewars/uScript.pas
changeset 7573 364cd923db43
parent 7567 da2aa8355d91
child 7628 bc7b1d228a2c
--- a/hedgewars/uScript.pas	Wed Aug 22 10:27:26 2012 +0400
+++ b/hedgewars/uScript.pas	Tue Aug 21 21:46:05 2012 -0400
@@ -980,10 +980,13 @@
         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (CurrentHedgehog <> nil) then
             begin
             prevgear := CurrentHedgehog^.Gear;
-            prevgear^.Active := false;
-            prevgear^.State:= prevgear^.State and (not gstHHDriven);
-            prevgear^.Z := cHHZ;
-            prevgear^.Message:= prevgear^.Message or gmRemoveFromList or gmAddToList;
+            if prevgear <> nil then
+                begin
+                prevgear^.Active := false;
+                prevgear^.State:= prevgear^.State and (not gstHHDriven);
+                prevgear^.Z := cHHZ;
+                prevgear^.Message:= prevgear^.Message or gmRemoveFromList or gmAddToList;
+                end;
             
             SwitchCurrentHedgehog(gear^.Hedgehog);
             CurrentTeam:= CurrentHedgehog^.Team;