fix segfault on HH-gear being 0 (e.g. after drowning) in cursor/target selection mode, thanks "ivze" for the heads-up!
authorsheepluva
Mon, 28 Jun 2010 21:52:00 +0200
changeset 3582 4debed8656d7
parent 3581 8cdf8f577800
child 3583 13818670ad9e
fix segfault on HH-gear being 0 (e.g. after drowning) in cursor/target selection mode, thanks "ivze" for the heads-up!
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Mon Jun 28 21:49:59 2010 +0400
+++ b/hedgewars/uWorld.pas	Mon Jun 28 21:52:00 2010 +0200
@@ -596,7 +596,6 @@
 DrawWater(255, 0);
 
 // Attack bar
-// TODO: Add weapon offset
 if CurrentTeam <> nil then
     case AttackBar of
 (*        1: begin
@@ -974,7 +973,7 @@
    if not bShowAmmoMenu then
      begin
      with CurrentHedgehog^ do
-       if (Gear^.State and gstHHChooseTarget) <> 0 then
+       if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then
          begin
          i:= Ammo^[CurSlot, CurAmmo].Pos;
          with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do