feat: set list head's prev in parse_array and parse_object

This commit is contained in:
miaoerduo 2020-04-03 11:52:54 +08:00 committed by zhaoyu
parent 39853e5148
commit 3999b12848

View File

@ -1509,6 +1509,10 @@ static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buf
success: success:
input_buffer->depth--; input_buffer->depth--;
if (head != NULL) {
head->prev = current_item;
}
item->type = cJSON_Array; item->type = cJSON_Array;
item->child = head; item->child = head;
@ -1681,6 +1685,10 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu
success: success:
input_buffer->depth--; input_buffer->depth--;
if (head != NULL) {
head->prev = current_item;
}
item->type = cJSON_Object; item->type = cJSON_Object;
item->child = head; item->child = head;