From 3ac2cfcc8837dd79890c2f7ea2706b5d01ba6c82 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 Sep 2014 20:08:49 +0000 Subject: ancient evil destroyed git-svn-id: http://svn.miranda-ng.org/main/trunk@10549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/lists.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mir_core/lists.cpp') diff --git a/src/mir_core/lists.cpp b/src/mir_core/lists.cpp index 118dc5789f..f981927cd8 100644 --- a/src/mir_core/lists.cpp +++ b/src/mir_core/lists.cpp @@ -52,11 +52,11 @@ MIR_CORE_DLL(void) List_Destroy(SortedList* p_list) MIR_CORE_DLL(void*) List_Find(SortedList* p_list, void* p_value) { - int index; - if (!List_GetIndex(p_list, p_value, &index)) + int idx; + if (!List_GetIndex(p_list, p_value, &idx)) return NULL; - return p_list->items[index]; + return p_list->items[idx]; } #ifdef _DEBUG @@ -193,8 +193,11 @@ MIR_CORE_DLL(int) List_InsertPtr(SortedList* list, void* p) if (p == NULL) return -1; - int idx = list->realCount; - List_GetIndex(list, p, &idx); + int idx; + if (list->sortFunc == 0) + idx = list->realCount; + else + List_GetIndex(list, p, &idx); return List_Insert(list, p, idx); } -- cgit v1.2.3