This commit is contained in:
Zhao Zhixu 2024-02-13 21:40:19 +04:00 committed by GitHub
commit c87a22aec9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

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