hedgewars/uGearsList.pas
changeset 10638 99975e1860d2
parent 10636 aba9ae27ead0
child 10639 992863acb2b7
--- a/hedgewars/uGearsList.pas	Mon Dec 08 10:30:20 2014 -0500
+++ b/hedgewars/uGearsList.pas	Mon Dec 08 10:55:56 2014 -0500
@@ -726,9 +726,11 @@
     FollowGear:= nil;
 if lastGearByUID = Gear then
     lastGearByUID := nil;
-if Gear^.Hedgehog^.GearHidden <> Gear then // hidden hedgehogs shouldn't be in the list
+if (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.GearHidden <> Gear) then // hidden hedgehogs shouldn't be in the list
     RemoveGearFromList(Gear);
-Gear^.Hedgehog^.GearHidden:= nil;
+if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.GearHidden = Gear) then
+    Gear^.Hedgehog^.GearHidden:= nil;
+
 Dispose(Gear)
 end;