!61 【挑单到4.0-Release】cJSON_SetValuestring入参增加判空防止错误调用导致崩溃

Merge pull request !61 from 刘波/cherry-pick-1716445384
This commit is contained in:
openharmony_ci
2024-05-23 08:04:43 +00:00
committed by Gitee
+1 -1
View File
@@ -406,7 +406,7 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
return NULL;
}
/* return NULL if the object is corrupted */
if (object->valuestring == NULL)
if (object->valuestring == NULL || valuestring == NULL)
{
return NULL;
}