mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
handle null pointers: cJSONUtils_GeneratePatches
This commit is contained in:
parent
2d252ae595
commit
f0c1b896ba
@ -1228,7 +1228,14 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
|
|||||||
|
|
||||||
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to)
|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(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, false);
|
create_patches(patches, (const unsigned char*)"", from, to, false);
|
||||||
|
|
||||||
return patches;
|
return patches;
|
||||||
|
Loading…
Reference in New Issue
Block a user