Explorar el Código

handle null pointers: cJSON_Minify

Max Bruckner hace 8 años
padre
commit
24ea388dcf
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      cJSON.c

+ 6 - 0
cJSON.c

@@ -2390,6 +2390,12 @@ fail:
 CJSON_PUBLIC(void) cJSON_Minify(char *json)
 {
     unsigned char *into = (unsigned char*)json;
+
+    if (json == NULL)
+    {
+        return;
+    }
+
     while (*json)
     {
         if (*json == ' ')