Merge pull request #210 from Nextra/destroy-invalid
Fix ArrayDestroy/DestroyStack erroring on invalid handle
This commit is contained in:
commit
3b16c6be92
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user