From d314c3e1a68dea79de1b3c1c22aa2537b05af63b Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 22 Nov 2021 21:36:29 +0100 Subject: [PATCH] fixed ListIterator.reachedEnd edge case --- src/utils/ListIterator.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/ListIterator.js b/src/utils/ListIterator.js index d3bdf562..42aa6237 100644 --- a/src/utils/ListIterator.js +++ b/src/utils/ListIterator.js @@ -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 }