mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 15:21:54 +00:00
Added sanity check to index passed to GetWeapon() to avoid crash when the value of AvHHud::CurrentWeapon() is -1.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@104 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
df5227cb08
commit
56353c5987
1 changed files with 8 additions and 1 deletions
|
@ -165,7 +165,14 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
WEAPON* WeaponsResource::GetWeapon( int iId ) { return rgWeapons[iId].iId ? &rgWeapons[iId] : NULL; }
|
||||
WEAPON* WeaponsResource::GetWeapon( int iId )
|
||||
{
|
||||
if( iId < 0 || iId >= MAX_WEAPONS ) { return NULL; }
|
||||
return rgWeapons[iId].iId ? &rgWeapons[iId] : NULL;
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
WEAPON* WeaponsResource::GetWeaponSlot( int slot, int pos ) { return rgSlots[slot][pos]; }
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
Loading…
Reference in a new issue