hedgewars/uGearsHandlersRope.pas
changeset 10681 474d418a34c5
parent 10108 c68cf030eded
child 10684 d403fd2f9a6f
--- a/hedgewars/uGearsHandlersRope.pas	Tue Dec 16 08:04:18 2014 -0500
+++ b/hedgewars/uGearsHandlersRope.pas	Tue Dec 16 14:23:24 2014 -0500
@@ -34,6 +34,12 @@
     tX:     hwFloat;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
+    if HHGear = nil then
+        begin
+        DeleteGear(Gear);
+        exit()
+        end;
+
     tX:= HHGear^.X;
     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
@@ -124,6 +130,11 @@
     if GameTicks mod 4 <> 0 then exit;
 
     HHGear := Gear^.Hedgehog^.Gear;
+    if HHGear = nil then
+        begin
+        DeleteGear(Gear);
+        exit()
+        end;
 
     tX:= HHGear^.X;
     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
@@ -414,6 +425,12 @@
     Gear^.Elasticity := Gear^.Elasticity + _1;
 
     HHGear := Gear^.Hedgehog^.Gear;
+    if HHGear = nil then
+        begin
+        DeleteGear(Gear);
+        exit()
+        end;
+
     DeleteCI(HHGear);
 
     if (HHGear^.State and gstMoving) <> 0 then