From 9abe75e072050f34732a7169740989a082b65134 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 14 Jun 2017 17:20:12 +0200 Subject: [PATCH] cJSON_Utils: Fix get_item_from_pointer Accessing nested arrays didn't work as intended. --- cJSON_Utils.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 8f99c2e..bd67201 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -279,16 +279,17 @@ static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, { current_element = current_element->next; } - /* skip to the next path token or end of string */ - while ((pointer[0] != '\0') && (pointer[0] != '/')) - { - pointer++; - } } else { return NULL; } + + /* skip to the next path token or end of string */ + while ((pointer[0] != '\0') && (pointer[0] != '/')) + { + pointer++; + } } return current_element;