From c179509b31c22c412108c0e076b968e77b9def2c Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Tue, 27 Jun 2017 23:02:14 +0200 Subject: [PATCH] handle null pointers: cJSON_AddItemReferenceToArray --- cJSON.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cJSON.c b/cJSON.c index 5d3c4a7..2c3f9e6 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1844,6 +1844,11 @@ CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJ CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { + if (array == NULL) + { + return; + } + cJSON_AddItemToArray(array, create_reference(item, &global_hooks)); }