From 39745c9c75025336f94207ddc7bd962f09deee99 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Wed, 28 Jun 2017 14:07:25 +0200 Subject: [PATCH] handle null pointers: cJSON_ReplaceItemViaPointer --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index ed2246e..b3abfb4 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1963,7 +1963,7 @@ CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newit CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) { - if ((parent == NULL) || (replacement == NULL)) + if ((parent == NULL) || (replacement == NULL) || (item == NULL)) { return false; }