Fix error if manga has no chapters

master
Koitharu 2 years ago
parent 6048cb917e
commit a158a488f2
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -31,7 +31,11 @@ fun HistoryInfo(
history: MangaHistory?,
isIncognitoMode: Boolean
): HistoryInfo {
val chapters = manga?.chapters?.get(branch)
val chapters = if (manga?.chapters?.isEmpty() == true) {
emptyList()
} else {
manga?.chapters?.get(branch)
}
val currentChapter = if (history != null && !chapters.isNullOrEmpty()) {
chapters.indexOfFirst { it.id == history.chapterId }
} else {

Loading…
Cancel
Save