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, '章节位置无效'); + } }, ), );