diff --git a/cJSON.c b/cJSON.c index 6e4fb0dd..904b11e4 100644 --- a/cJSON.c +++ b/cJSON.c @@ -2439,6 +2439,9 @@ CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *st CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) { + if (newitem == NULL) { + return false; + } return replace_item_in_object(object, string, newitem, true); }