mirror of
https://github.com/DaveGamble/cJSON.git
synced 2025-05-17 23:16:17 +08:00
cJSON_DetachItemViaPointer: added test and fix for check for null in item->prev
This commit is contained in:

committed by
Alan Wang

parent
f28a468e3b
commit
a78d975537
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) || (parent->child == NULL) || (item == NULL) || (item->prev == NULL))
|
||||
if ((parent == NULL) || (item == NULL) || (item != parent->child && item->prev == NULL))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user