mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-12 14:58:06 +03:00
Fix missing param check
This commit is contained in:
parent
c141103824
commit
1754a86869
@ -1953,11 +1953,20 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon_entity(AMX *amx, cell *params)
|
|||||||
GET_OFFSET("CBasePlayerItem", m_pNext);
|
GET_OFFSET("CBasePlayerItem", m_pNext);
|
||||||
|
|
||||||
int playerIndex = params[1];
|
int playerIndex = params[1];
|
||||||
int weaponIndex = params[2];
|
|
||||||
|
|
||||||
CHECK_PLAYER(playerIndex);
|
CHECK_PLAYER(playerIndex);
|
||||||
edict_t *pPlayer = MF_GetPlayerEdict(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;
|
int weaponEntIndex = -1;
|
||||||
if (weaponIndex == CSW_NONE)
|
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));
|
pWeapon = TypeConversion.cbase_to_edict(get_pdata<void *>(pWeapon, m_pNext));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundWeapon)
|
if (foundWeapon)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user