From 8004ed31158caf50b7d2a3f8777a7ebd6c66240d Mon Sep 17 00:00:00 2001 From: Dave Gamble Date: Fri, 13 Feb 2015 20:33:06 +0000 Subject: [PATCH] Fix bug with the sort. git-svn-id: svn://svn.code.sf.net/p/cjson/code@73 e3330c51-1366-4df0-8b21-3ccf24e3d50e --- cJSON_Utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index dc20fd7..c4a0ae0 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -307,6 +307,7 @@ static cJSON *cJSONUtils_SortList(cJSON *list) while (ptr && ptr->next && cJSONUtils_strcasecmp(ptr->string,ptr->next->string)<0) ptr=ptr->next; /* Test for list sorted. */ if (!ptr || !ptr->next) return list; /* Leave sorted lists unmodified. */ + ptr=list; while (ptr) {second=second->next;ptr=ptr->next;if (ptr) ptr=ptr->next;} /* Walk two pointers to find the middle. */ if (second && second->prev) second->prev->next=0; /* Split the lists */