mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
handle null pointers: cJSON_AddItemReferenceToArray
This commit is contained in:
parent
46c4f55c94
commit
c179509b31
5
cJSON.c
5
cJSON.c
@ -1844,6 +1844,11 @@ CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJ
|
|||||||
|
|
||||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item)
|
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item)
|
||||||
{
|
{
|
||||||
|
if (array == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cJSON_AddItemToArray(array, create_reference(item, &global_hooks));
|
cJSON_AddItemToArray(array, create_reference(item, &global_hooks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user