mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-27 14:14:07 +08:00
handle null pointer: get_item_from_pointer
This commit is contained in:
parent
9bdf19fde1
commit
1af74c8cc1
@ -262,6 +262,12 @@ static cJSON_bool decode_array_index_from_pointer(const unsigned char * const po
|
||||
static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive)
|
||||
{
|
||||
cJSON *current_element = object;
|
||||
|
||||
if (pointer == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* follow path of the pointer */
|
||||
while ((pointer[0] == '/') && (current_element != NULL))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user