mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-26 12:41:03 +08:00
fix: error list head's prev when detach the last item
This commit is contained in:
parent
3999b12848
commit
a65abf2f4f
6
cJSON.c
6
cJSON.c
@ -2210,6 +2210,12 @@ CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const it
|
||||
/* first element */
|
||||
parent->child = item->next;
|
||||
}
|
||||
else if (item->next == NULL)
|
||||
{
|
||||
/* last element */
|
||||
parent->child->prev = item->prev;
|
||||
}
|
||||
|
||||
/* make sure the detached item doesn't point anywhere anymore */
|
||||
item->prev = NULL;
|
||||
item->next = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user