Fix ArrayDestroy/DestroyStack erroring on null handle

This commit is contained in:
Valentin Grünbacher 2015-02-17 23:24:17 +01:00
parent c071f53f2c
commit 78f577686a
2 changed files with 25 additions and 13 deletions

View File

@ -661,6 +661,12 @@ static cell AMX_NATIVE_CALL ArrayDeleteItem(AMX* amx, cell* params)
static cell AMX_NATIVE_CALL ArrayDestroy(AMX* amx, cell* params) static cell AMX_NATIVE_CALL ArrayDestroy(AMX* amx, cell* params)
{ {
cell* handle = get_amxaddr(amx, params[1]); cell* handle = get_amxaddr(amx, params[1]);
if (*handle == 0)
{
return 0;
}
CellArray* vec = HandleToVector(amx, *handle); CellArray* vec = HandleToVector(amx, *handle);
if (vec == NULL) if (vec == NULL)

View File

@ -241,6 +241,12 @@ static cell AMX_NATIVE_CALL IsStackEmpty(AMX* amx, cell* params)
static cell AMX_NATIVE_CALL DestroyStack(AMX* amx, cell* params) static cell AMX_NATIVE_CALL DestroyStack(AMX* amx, cell* params)
{ {
cell *handle = get_amxaddr(amx, params[1]); cell *handle = get_amxaddr(amx, params[1]);
if (*handle == 0)
{
return 0;
}
CellArray *vec = HandleToVector(amx, *handle); CellArray *vec = HandleToVector(amx, *handle);
if (vec == NULL) if (vec == NULL)