Fix missing param check

This commit is contained in:
HamletEagle 2018-09-05 11:58:11 -07:00
parent c141103824
commit 1754a86869

View File

@ -1953,11 +1953,20 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon_entity(AMX *amx, cell *params)
GET_OFFSET("CBasePlayerItem", m_pNext);
int playerIndex = params[1];
int weaponIndex = params[2];
CHECK_PLAYER(playerIndex);
edict_t *pPlayer = MF_GetPlayerEdict(playerIndex);
int paramsCount = *params / sizeof(cell), weaponIndex;
if (paramsCount == 1)
{
weaponIndex = CSW_NONE;
}
else
{
weaponIndex = params[2];
}
int weaponEntIndex = -1;
if (weaponIndex == CSW_NONE)
{
@ -1987,7 +1996,6 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon_entity(AMX *amx, cell *params)
}
pWeapon = TypeConversion.cbase_to_edict(get_pdata<void *>(pWeapon, m_pNext));
}
if (foundWeapon)