oh, probably need nil checks here too
authornemo
Mon, 08 Dec 2014 10:55:56 -0500
changeset 10638 99975e1860d2
parent 10637 13a5dd92ebf9
child 10639 992863acb2b7
oh, probably need nil checks here too
hedgewars/uGearsList.pas
--- 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;