From a158a488f21e1805711f94fac7c7e6471cf2b5c9 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sun, 7 Jul 2024 07:47:56 +0300 Subject: [PATCH] Fix error if manga has no chapters --- .../org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt index e59f7f712..a87a32b97 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt @@ -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 {