Skip to content

Commit f0c1b89

Browse files
committed
handle null pointers: cJSONUtils_GeneratePatches
1 parent 2d252ae commit f0c1b89

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎cJSON_Utils.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,14 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
12281228

12291229
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to)
12301230
{
1231-
cJSON *patches = cJSON_CreateArray();
1231+
cJSON *patches = NULL;
1232+
1233+
if ((from == NULL) || (to == NULL))
1234+
{
1235+
return NULL;
1236+
}
1237+
1238+
patches = cJSON_CreateArray();
12321239
create_patches(patches, (const unsigned char*)"", from, to, false);
12331240

12341241
return patches;

0 commit comments

Comments
 (0)