src/array_list.c

changeset 1022
2911c1f4a570
parent 1019
09c6fe8fe3b9
child 1040
1ecf4dbbc60c
--- a/src/array_list.c	Sun Dec 15 16:10:19 2024 +0100
+++ b/src/array_list.c	Sun Dec 15 16:28:05 2024 +0100
@@ -435,6 +435,9 @@
         return 0;
     }
 
+    // special case: there is only one element and that is smaller
+    if (size == 1) return 0;
+
     // check the last array element
     result = cmp_func(elem, array + elem_size * (size - 1));
     if (result >= 0) {

mercurial