瀏覽代碼

handle null pointer: sort_object

Max Bruckner 8 年之前
父節點
當前提交
c46c4d1559
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      cJSON_Utils.c

+ 4 - 0
cJSON_Utils.c

@@ -550,6 +550,10 @@ static cJSON *sort_list(cJSON *list, const cJSON_bool case_sensitive)
 
 static void sort_object(cJSON * const object, const cJSON_bool case_sensitive)
 {
+    if (object == NULL)
+    {
+        return;
+    }
     object->child = sort_list(object->child, case_sensitive);
 }