diff --git a/cJSON.c b/cJSON.c index cac1164b..483d0c0c 100644 --- a/cJSON.c +++ b/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; }