From 3999b12848214a201bf56ef416b9dac1ec63f811 Mon Sep 17 00:00:00 2001 From: miaoerduo Date: Fri, 3 Apr 2020 11:52:54 +0800 Subject: [PATCH] feat: set list head's prev in parse_array and parse_object --- cJSON.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cJSON.c b/cJSON.c index a5d3987..500fcf5 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1509,6 +1509,10 @@ static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buf success: input_buffer->depth--; + if (head != NULL) { + head->prev = current_item; + } + item->type = cJSON_Array; item->child = head; @@ -1681,6 +1685,10 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu success: input_buffer->depth--; + if (head != NULL) { + head->prev = current_item; + } + item->type = cJSON_Object; item->child = head;