fix: unsigned underflow on empty array

This commit is contained in:
2026-05-16 13:25:02 +02:00
parent 2843e5e863
commit c68bebfd7c
+4
View File
@@ -13,6 +13,10 @@ unsigned int arr_uint_index_of(UintArray array, unsigned int value) {
}
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index) {
if (offsets.length == 0) {
return 0;
}
for (unsigned int i = offsets.length - 1; i > 0; i--) {
if (*index >= offsets.values[i]) {
*index -= offsets.values[i];