mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
fix detaching the tail of an array
This commit is contained in:
parent
a20701e91d
commit
b5d6cfc759
5
cJSON.c
5
cJSON.c
@ -2117,6 +2117,11 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it
|
|||||||
/* not the last element */
|
/* not the last element */
|
||||||
item->next->prev = item->prev;
|
item->next->prev = item->prev;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* the last element - need to fix the prev pointer of the 1st element */
|
||||||
|
parent->child->prev = item->prev;
|
||||||
|
}
|
||||||
|
|
||||||
if (item == parent->child)
|
if (item == parent->child)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user