diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 59bdd7e6..b4236c62 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -844,7 +844,20 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params) int player = params[1]; int page = params[3]; + + if (player < 1 || player > gpGlobals->maxClients) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d.", player); + return 0; + } + CPlayer* pPlayer = GET_PLAYER_POINTER_I(player); + + if (!pPlayer->ingame) + { + LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game.", player); + return 0; + } if (!CloseNewMenus(pPlayer)) {