Handle unimplented chapter urls

This commit is contained in:
Jays2Kings 2023-02-16 17:04:56 -05:00
parent 98cba545a5
commit 480567419f
3 changed files with 5 additions and 5 deletions

View file

@ -398,7 +398,7 @@ abstract class HttpSource : CatalogueSource {
manga ?: return null
val chapterUrl = chapter.url.getUrlWithoutDomain()
val mangaUrl = mangaDetailsRequest(manga).url.toString()
val mangaUrl = getMangaUrl(manga)
return if (chapterUrl.isBlank()) {
mangaUrl
} else {

View file

@ -237,8 +237,8 @@ class MangaDetailsPresenter(
fun getChapterUrl(chapter: Chapter): String? {
val source = source as? HttpSource ?: return null
val chapterUrl = source.getChapterUrl(chapter)
return chapterUrl.takeIf { it.isNotEmpty() } ?: source.getChapterUrl(manga, chapter)
val chapterUrl = try { source.getChapterUrl(chapter) } catch (_: Exception) { null }
return chapterUrl.takeIf { !it.isNullOrBlank() } ?: source.getChapterUrl(manga, chapter)
}
private fun getScrollType(chapters: List<ChapterItem>) {

View file

@ -637,8 +637,8 @@ class ReaderViewModel(
val manga = manga ?: return null
val source = getSource() ?: return null
val chapter = getCurrentChapter()?.chapter ?: return null
val chapterUrl = source.getChapterUrl(chapter)
return chapterUrl.takeIf { it.isNotEmpty() } ?: source.getChapterUrl(manga, chapter)
val chapterUrl = try { source.getChapterUrl(chapter) } catch (_: Exception) { null }
return chapterUrl.takeIf { !it.isNullOrBlank() } ?: source.getChapterUrl(manga, chapter)
}
fun getSource() = manga?.source?.let { sourceManager.getOrStub(it) } as? HttpSource