Merge pull request #210 from Nextra/destroy-invalid

Fix ArrayDestroy/DestroyStack erroring on invalid handle
This commit is contained in:
Vincent Herbet 2015-02-18 00:44:26 +01:00
commit 3b16c6be92
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)