Fix a crash on the same newmenu overlapping (#462)

This commit is contained in:
Vincent Herbet 2017-10-03 20:43:30 +02:00 committed by GitHub
parent 361a6cc9e0
commit 97df408d51

View File

@ -809,18 +809,25 @@ static cell AMX_NATIVE_CALL menu_items(AMX *amx, cell *params)
//page indices start at 0!
static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
{
GETMENU(params[2]);
auto handle = params[2];
GETMENU(handle);
int player = params[1];
int page = params[3];
CPlayer* pPlayer = GET_PLAYER_POINTER_I(player);
if (!CloseNewMenus(pPlayer))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
return 0;
}
if (!g_NewMenus[handle])
{
LogError(amx, AMX_ERR_NATIVE, "Invalid menu id %d (was previously destroyed).", handle);
return 0;
}
int time = -1;
if (params[0] / sizeof(cell) >= 4)
time = params[4];