From a0a146854b0cc31668aaf0e27ef7da4ba961caa9 Mon Sep 17 00:00:00 2001 From: DelLevin-Home Date: Wed, 1 Jul 2026 18:46:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=201.EPUB=20=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=AF=BC=E8=88=AA=E7=BC=BA=E5=B0=91=E8=B6=8A?= =?UTF-8?q?=E7=95=8C=E4=BF=9D=E6=8A=A4=202.=E4=BC=98=E5=8C=96=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E5=9B=9E=E6=94=B6=E7=AB=99=E6=97=B6=20N=20=E6=9D=A1?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=A6=E5=8F=91=20N=20=E6=AC=A1=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/epub_reader/reader_screen.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pages/epub_reader/reader_screen.dart b/lib/pages/epub_reader/reader_screen.dart index 5d60337..850f516 100644 --- a/lib/pages/epub_reader/reader_screen.dart +++ b/lib/pages/epub_reader/reader_screen.dart @@ -416,8 +416,12 @@ class _ReaderScreenState extends State streamService: _streamService, onNavigate: (spineIndex, keyword, scrollRatio) { Navigator.pop(ctx); - setState(() => currentSpineItemIndex = spineIndex); - loadCarousel(restoreScrollRatio: scrollRatio); + if (spineIndex >= 0 && spineIndex < bookSession.spine.length) { + setState(() => currentSpineItemIndex = spineIndex); + loadCarousel(restoreScrollRatio: scrollRatio); + } else if (mounted) { + ToastUtil.show(context, '章节位置无效'); + } }, ), );