Ver código fonte

handle null pointer: cJSONUtils_FindPointerFromObjectTo

Max Bruckner 8 anos atrás
pai
commit
9bdf19fde1
1 arquivos alterados com 5 adições e 0 exclusões
  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 */