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