fixed ListIterator.reachedEnd edge case

This commit is contained in:
Kevin Jahns 2021-11-22 21:36:29 +01:00
parent 2a33507c00
commit d314c3e1a6

View File

@ -169,7 +169,12 @@ export class ListIterator {
throw lengthExceeded
}
this.index -= len
if (this.rel > len) {
if (this.reachedEnd) {
const nextItem = /** @type {Item} */ (this.nextItem)
this.rel = nextItem.countable && !nextItem.deleted ? nextItem.length : 0
this.reachedEnd = false
}
if (this.rel >= len) {
this.rel -= len
return this
}