bug #823 missing nil checks crasher introduced in
r4aa19b21707d
--- a/hedgewars/uAmmos.pas Thu Jun 04 12:33:24 2020 +0200
+++ b/hedgewars/uAmmos.pas Tue Apr 13 15:40:11 2021 -0400
@@ -406,7 +406,7 @@
CurWeapon:= GetCurAmmoEntry(Hedgehog);
OldWeapon:= GetCurAmmoEntry(Hedgehog);
- if (Hedgehog.Gear^.State and gstHHDriven) = 0 then
+ if (Hedgehog.Gear <> nil) and (Hedgehog.Gear^.State and gstHHDriven = 0) then
Hedgehog.CurAmmoType:= amNothing
else if (CurWeapon^.Count = 0) then
SwitchToFirstLegalAmmo(Hedgehog)
@@ -431,7 +431,7 @@
s:= s + ansistring(' (' + IntToStr(Count) + ')');
if (Propz and ammoprop_Timerable) <> 0 then
s:= s + ansistring(', ' + IntToStr(Timer div 1000) + ' ') + trammo[sidSeconds];
- if (Hedgehog.Gear^.State and gstHHDriven) <> 0 then
+ if (Hedgehog.Gear <> nil) and (Hedgehog.Gear^.State and gstHHDriven <> 0) then
AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo);
if (Propz and ammoprop_NeedTarget) <> 0 then
begin