mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-26 12:41:03 +08:00
Check for NULL in cJSON_DetachItemViaPointer
This commit is contained in:
parent
424ce4ce96
commit
f28a468e3b
2
cJSON.c
2
cJSON.c
@ -2204,7 +2204,7 @@ CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * c
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item)
|
||||
{
|
||||
if ((parent == NULL) || (item == NULL))
|
||||
if ((parent == NULL) || (parent->child == NULL) || (item == NULL) || (item->prev == NULL))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user