mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
handle null pointers: cJSON_AddItemToObjectCS
This commit is contained in:
parent
90ff72c8bb
commit
46c4f55c94
2
cJSON.c
2
cJSON.c
@ -1826,7 +1826,7 @@ CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSO
|
|||||||
/* Add an item to an object with constant string as key */
|
/* Add an item to an object with constant string as key */
|
||||||
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
|
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
|
||||||
{
|
{
|
||||||
if (!item)
|
if ((item == NULL) || (string == NULL))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user