Fix branch detection #143

pull/153/head testbuild-170422
Koitharu 4 years ago
parent d61ba80bf6
commit 5fbae1256b
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -191,7 +191,8 @@ class DetailsViewModel(
// find default branch
val hist = historyRepository.getOne(manga)
selectedBranch.value = if (hist != null) {
manga.chapters?.find { it.id == hist.chapterId }?.branch
val currentChapter = manga.chapters?.find { it.id == hist.chapterId }
if (currentChapter != null) currentChapter.branch else predictBranch(manga.chapters)
} else {
predictBranch(manga.chapters)
}
@ -203,6 +204,8 @@ class DetailsViewModel(
} else {
localMangaRepository.findSavedManga(manga)
}
}.onFailure { error ->
if (BuildConfig.DEBUG) error.printStackTrace()
}.getOrNull()
}

Loading…
Cancel
Save