Fix spectator crash due to missing nil check in new dust gear, init Ammo to nil in World prior to nil check
--- a/hedgewars/GSHandlers.inc Wed Feb 24 03:03:43 2010 +0000
+++ b/hedgewars/GSHandlers.inc Wed Feb 24 13:29:06 2010 +0000
@@ -106,7 +106,7 @@
for i:= min(12, (3 + dmg div 10)) downto 0 do begin
particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
- particle^.dX := particle^.dX + (Gear^.dX / 5);
+ if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5);
end;
ApplyDamage(Gear, dmg);
--- a/hedgewars/uWorld.pas Wed Feb 24 03:03:43 2010 +0000
+++ b/hedgewars/uWorld.pas Wed Feb 24 13:29:06 2010 +0000
@@ -139,6 +139,7 @@
else
if AMxShift < 210 then inc(AMxShift, MENUSPEED);
end;
+Ammo:= nil;
if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
Ammo:= CurrentHedgehog^.Ammo
else if (LocalAmmo <> -1) then