Procházet zdrojové kódy

handle null pointer: cJSONUtils_FindPointerFromObjectTo

Max Bruckner před 8 roky
rodič
revize
9bdf19fde1
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      cJSON_Utils.c

+ 5 - 0
cJSON_Utils.c

@@ -162,6 +162,11 @@ CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const obje
     size_t child_index = 0;
     cJSON *current_child = 0;
 
+    if ((object == NULL) || (target == NULL))
+    {
+        return NULL;
+    }
+
     if (object == target)
     {
         /* found */