From 8558b00dca8b5a649d965a73a97ca6d10359b704 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 3 Feb 2024 16:53:26 +0200 Subject: [PATCH] Fix chapter number for saved chapters --- .../kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt index 05399af96..be673d4af 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/ReaderViewModel.kt @@ -404,7 +404,7 @@ class ReaderViewModel @Inject constructor( val state = getCurrentState().assertNotNull("state") ?: return val chapter = chaptersLoader.peekChapter(state.chapterId).assertNotNull("chapter") ?: return val m = manga.assertNotNull("manga") ?: return - val chapterIndex = m.chapters[chapter.branch]?.indexOf(chapter) ?: -1 + val chapterIndex = m.chapters[chapter.branch]?.indexOfFirst { it.id == chapter.id } ?: -1 val newState = ReaderUiState( mangaName = m.toManga().title, branch = chapter.branch,