From 35cba8bbb959ea068f7fb8afc60f9a5f3d145d89 Mon Sep 17 00:00:00 2001 From: stefv Date: Thu, 10 Apr 2025 21:16:28 +0200 Subject: [PATCH] #567 Use the length and not the last value of the chapter indexes --- packages/epub_view/lib/src/ui/epub_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/epub_view/lib/src/ui/epub_view.dart b/packages/epub_view/lib/src/ui/epub_view.dart index 28ece456..a7eaf55a 100644 --- a/packages/epub_view/lib/src/ui/epub_view.dart +++ b/packages/epub_view/lib/src/ui/epub_view.dart @@ -251,7 +251,7 @@ class _EpubViewState extends State { trailingEdge: trailingEdge, leadingEdge: leadingEdge, ); - final index = posIndex >= _chapterIndexes.last + final index = posIndex >= _chapterIndexes.length ? _chapterIndexes.length : _chapterIndexes.indexWhere((chapterIndex) { if (posIndex < chapterIndex) {