mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
Merge 860ed3a77c
into cb8693b058
This commit is contained in:
commit
5ffec39d1a
9
cJSON.c
9
cJSON.c
@ -405,10 +405,13 @@ CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (strlen(valuestring) <= strlen(object->valuestring))
|
||||
if (object->valuestring != NULL)
|
||||
{
|
||||
strcpy(object->valuestring, valuestring);
|
||||
return object->valuestring;
|
||||
if (strlen(valuestring) <= strlen(object->valuestring))
|
||||
{
|
||||
strcpy(object->valuestring, valuestring);
|
||||
return object->valuestring;
|
||||
}
|
||||
}
|
||||
copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks);
|
||||
if (copy == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user