Skip to content

Commit

Permalink
Check for NULL in cJSON_DetachItemViaPointer
Browse files Browse the repository at this point in the history
  • Loading branch information
vwvw authored and Alanscut committed Aug 30, 2024
1 parent 424ce4c commit f28a468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f28a468

Please sign in to comment.