NavBot.cpp: fix possible crash

This commit is contained in:
Unnamed 2019-02-21 13:58:41 +00:00 committed by TotallyNotElite
parent 05c9827f43
commit bc8229041d

View File

@ -311,6 +311,8 @@ static inline bool hasLowAmmo()
if (CE_BAD(LOCAL_W)) if (CE_BAD(LOCAL_W))
return false; return false;
int *weapon_list = (int *) ((uint64_t)(RAW_ENT(LOCAL_E)) + netvar.hMyWeapons); int *weapon_list = (int *) ((uint64_t)(RAW_ENT(LOCAL_E)) + netvar.hMyWeapons);
if (!weapon_list)
return false;
if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_E, netvar.m_iAmmo + 4) <= 5) if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_E, netvar.m_iAmmo + 4) <= 5)
return true; return true;
for (int i = 0; weapon_list[i]; i++) for (int i = 0; weapon_list[i]; i++)