diff -r 4523f6d42512 -r 741a2040fa33 src/array_list.c --- a/src/array_list.c Mon Dec 18 16:04:21 2023 +0100 +++ b/src/array_list.c Mon Dec 18 16:14:07 2023 +0100 @@ -27,6 +27,7 @@ */ #include "cx/array_list.h" +#include "cx/compare.h" #include #include @@ -522,13 +523,14 @@ list->base.cl = &cx_array_list_class; list->base.allocator = allocator; - list->base.cmpfunc = comparator; list->capacity = initial_capacity; if (item_size > 0) { list->base.item_size = item_size; + list->base.cmpfunc = comparator; } else { item_size = sizeof(void *); + list->base.cmpfunc = comparator == NULL ? cx_cmp_ptr : comparator; cxListStorePointers((CxList *) list); }