diff -r 1f22de6977a1 -r 2911c1f4a570 src/array_list.c --- 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) {