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 // find default branch
val hist = historyRepository.getOne(manga) val hist = historyRepository.getOne(manga)
selectedBranch.value = if (hist != null) { 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 { } else {
predictBranch(manga.chapters) predictBranch(manga.chapters)
} }
@ -203,6 +204,8 @@ class DetailsViewModel(
} else { } else {
localMangaRepository.findSavedManga(manga) localMangaRepository.findSavedManga(manga)
} }
}.onFailure { error ->
if (BuildConfig.DEBUG) error.printStackTrace()
}.getOrNull() }.getOrNull()
} }

Loading…
Cancel
Save