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,