handle null pointers: cJSON_AddItemReferenceToObject

This commit is contained in:
Max Bruckner 2017-06-27 23:03:23 +02:00
parent c179509b31
commit b2fe02712d

View File

@ -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));
} }