hedgewars/uAmmos.pas
changeset 7341 d70478d265ec
parent 7337 c224cd2d32f3
child 7426 55b49cc1f33a
--- a/hedgewars/uAmmos.pas	Wed Jul 04 12:41:47 2012 -0400
+++ b/hedgewars/uAmmos.pas	Thu Jul 05 20:53:55 2012 +0400
@@ -303,22 +303,23 @@
 
 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
 begin
-with Hedgehog do
-    begin
-    CurMinAngle:= Ammoz[AmmoType].minAngle;
-    if Ammoz[AmmoType].maxAngle <> 0 then
-        CurMaxAngle:= Ammoz[AmmoType].maxAngle
-    else
-        CurMaxAngle:= cMaxAngle;
+if Hedgehog.Gear <> nil then
+    with Hedgehog do
+        begin
+        CurMinAngle:= Ammoz[AmmoType].minAngle;
+        if Ammoz[AmmoType].maxAngle <> 0 then
+            CurMaxAngle:= Ammoz[AmmoType].maxAngle
+        else
+            CurMaxAngle:= cMaxAngle;
 
-    with Hedgehog.Gear^ do
-        begin
-        if Angle < CurMinAngle then
-            Angle:= CurMinAngle;
-        if Angle > CurMaxAngle then
-            Angle:= CurMaxAngle;
+        with Hedgehog.Gear^ do
+            begin
+            if Angle < CurMinAngle then
+                Angle:= CurMinAngle;
+            if Angle > CurMaxAngle then
+                Angle:= CurMaxAngle;
+            end
         end
-    end
 end;
 
 procedure SwitchToFirstLegalAmmo(var Hedgehog: THedgehog);
@@ -380,12 +381,12 @@
         AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo);
         if (Propz and ammoprop_NeedTarget) <> 0 then
             begin
-            Gear^.State:= Gear^.State or      gstHHChooseTarget;
+            if Gear <> nil then Gear^.State:= Gear^.State or      gstHHChooseTarget;
             isCursorVisible:= true
             end
         else
             begin
-            Gear^.State:= Gear^.State and not gstHHChooseTarget;
+            if Gear <> nil then Gear^.State:= Gear^.State and not gstHHChooseTarget;
             isCursorVisible:= false
             end;
         end