diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 35fc450..84319cc 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -1243,7 +1243,14 @@ CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * con CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to) { - cJSON *patches = cJSON_CreateArray(); + cJSON *patches = NULL; + + if ((from == NULL) || (to == NULL)) + { + return NULL; + } + + patches = cJSON_CreateArray(); create_patches(patches, (const unsigned char*)"", from, to, true); return patches;