This commit is contained in:
ZhaoYandong00 2024-04-26 21:30:26 +08:00 committed by GitHub
commit 1e43d3d87f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -410,7 +410,7 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
{
return NULL;
}
if (strlen(valuestring) <= strlen(object->valuestring))
if (object->valuestring && (strlen(valuestring) <= strlen(object->valuestring)))
{
strcpy(object->valuestring, valuestring);
return object->valuestring;