handle null pointers: cJSON_AddItemReferenceToArray

This commit is contained in:
Max Bruckner 2017-06-27 23:02:14 +02:00
parent 46c4f55c94
commit c179509b31

View File

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