fix detaching the tail of an array

This commit is contained in:
Markus W. Weissmann 2020-07-02 11:15:31 +02:00
parent a20701e91d
commit b5d6cfc759
1 changed files with 5 additions and 0 deletions

View File

@ -2117,6 +2117,11 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it
/* not the last element */
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)
{