mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-06-06 05:14:39 +00: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
@@ -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