mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-09-07 07:59:53 +00:00
Check for NULL in cJSON_DetachItemViaPointer
This commit is contained in:
committed by
Alan Wang
parent
424ce4ce96
commit
f28a468e3b
@@ -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)
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user