Fix iterator bug in Nex()

This commit is contained in:
bloeys
2023-10-07 01:16:10 +04:00
parent 05ccf3e158
commit 3574318552

View File

@ -45,9 +45,10 @@ func (it *Iterator[T]) Next() (*T, Handle) {
continue continue
} }
it.remainingItems-- item := &it.registry.Items[it.currIndex]
it.currIndex++ it.currIndex++
return &it.registry.Items[it.currIndex], handle it.remainingItems--
return item, handle
} }
// If we reached here means we iterated to the end and didn't find anything, which probably // If we reached here means we iterated to the end and didn't find anything, which probably