Skip to content

Commit

Permalink
Validate weapon list entries in CWeapons::findWeapon
Browse files Browse the repository at this point in the history
This appears to fix the issue where the server would crash when using GiveBotsWeapons or similar plugins.
  • Loading branch information
nosoop committed Aug 11, 2020
1 parent cc23351 commit 2bf8354
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/RCBot2_meta/bot_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ edict_t *CWeapons :: findWeapon ( edict_t *pPlayer, const char *pszWeaponName )
{
pWeapon = INDEXENT(m_Weapon_iter->GetEntryIndex());

if ( strcmp(pWeapon->GetClassName(),pszWeaponName) == 0 )
// TODO get familiar with validity of handles / edicts
if (pWeapon && !pWeapon->IsFree() && strcmp(pWeapon->GetClassName(),pszWeaponName) == 0 )
return pWeapon;

m_Weapon_iter++;
Expand Down

0 comments on commit 2bf8354

Please sign in to comment.