From c20b2b3cc941b3f990a7caf44ac18fe257f18bee Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 6 Jan 2022 23:43:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/read/ReadBookActivity.kt | 2 +- app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index b8df716c3..f32b9a991 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -938,7 +938,7 @@ class ReadBookActivity : BaseReadBookActivity(), } } - if (previousResult.chapterIndex != searchResult.chapterIndex) { + if (searchResult.chapterIndex != previousResult?.chapterIndex) { viewModel.openChapter(searchResult.chapterIndex) { jumpToPosition() } diff --git a/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt index 7a9519109..3e6a444d0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/SearchMenu.kt @@ -46,8 +46,8 @@ class SearchMenu @JvmOverloads constructor( get() = searchResultList.isNotEmpty() val selectedSearchResult: SearchResult? get() = searchResultList.getOrNull(currentSearchResultIndex) - val previousSearchResult: SearchResult - get() = searchResultList[lastSearchResultIndex] + val previousSearchResult: SearchResult? + get() = searchResultList.getOrNull(lastSearchResultIndex) init { initAnimation()