mirror of https://github.com/DaveGamble/cJSON
Merge 5da11d6bea
into 87d8f0961a
This commit is contained in:
commit
c87a22aec9
8
cJSON.c
8
cJSON.c
|
@ -2559,7 +2559,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count)
|
|||
cJSON *p = NULL;
|
||||
cJSON *a = NULL;
|
||||
|
||||
if ((count < 0) || (numbers == NULL))
|
||||
if ((count < 0) || ((count > 0) && (numbers == NULL)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2599,7 +2599,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count)
|
|||
cJSON *p = NULL;
|
||||
cJSON *a = NULL;
|
||||
|
||||
if ((count < 0) || (numbers == NULL))
|
||||
if ((count < 0) || ((count > 0) && (numbers == NULL)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2639,7 +2639,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
|
|||
cJSON *p = NULL;
|
||||
cJSON *a = NULL;
|
||||
|
||||
if ((count < 0) || (numbers == NULL))
|
||||
if ((count < 0) || ((count > 0) && (numbers == NULL)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2679,7 +2679,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int co
|
|||
cJSON *p = NULL;
|
||||
cJSON *a = NULL;
|
||||
|
||||
if ((count < 0) || (strings == NULL))
|
||||
if ((count < 0) || ((count > 0) && (strings == NULL)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue