diff --git a/public/js/reader.js b/public/js/reader.js index c09c340..8bf1133 100644 --- a/public/js/reader.js +++ b/public/js/reader.js @@ -101,8 +101,9 @@ const readerComponent = () => { */ flipPage(isNext) { const idx = parseInt(this.curItem.id); - const delta = isNext ? 1 : -1; - const newIdx = idx + delta; + const newIdx = idx + (isNext ? 1 : -1); + + if (newIdx <= 0 || newIdx > this.items.length) return; this.toPage(newIdx);