mirror of
https://github.com/DaveGamble/cJSON
synced 2025-04-18 13:06:29 +00:00
Merge b2ea6cda22
into 12c4bf1986
This commit is contained in:
commit
389f17629b
4
cJSON.c
4
cJSON.c
@ -2220,7 +2220,7 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (item != parent->child)
|
||||
if (item != parent->child && item->prev != NULL)
|
||||
{
|
||||
/* not the first element */
|
||||
item->prev->next = item->next;
|
||||
@ -2236,7 +2236,7 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it
|
||||
/* first element */
|
||||
parent->child = item->next;
|
||||
}
|
||||
else if (item->next == NULL)
|
||||
else if (item->next == NULL && parent->child != NULL)
|
||||
{
|
||||
/* last element */
|
||||
parent->child->prev = item->prev;
|
||||
|
Loading…
Reference in New Issue
Block a user