handle null pointers: cJSON_PrintPreallocated

This commit is contained in:
Max Bruckner committed 2017-06-28 14:20:47 +02:00
1 parent cdc35ebf88
commit 56f2bc6f3e
1 file changed
+1 -1
+1 -1
View File
@@ -1122,7 +1122,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const i
{
printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
if (len < 0)
if ((len < 0) || (buf == NULL))
{
return false;
}