From fe6dff908649a0589140ca54233df55ea4fc8d57 Mon Sep 17 00:00:00 2001 From: Jake Merdich Date: Sat, 25 Jun 2016 07:01:44 -0400 Subject: [PATCH] Handle a missing page list in MangaHere (#366) This typically happens when a manga is pulled from their catalog (I tested it on Nisekoi). Previous behavior led to a NullPointerError, now gives an empty page list. Giving a reason to the user beyond "Empty Page list" would be a good idea in the future (this seems to be one holdup for #220), but there doesn't seem to be an obvious place to put it without touching the base classes. In the meantime, this is far more informative than null errors. --- .../eu/kanade/tachiyomi/data/source/online/english/Mangahere.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangahere.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangahere.kt index fb87e9dc5f..dd63a5d137 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangahere.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangahere.kt @@ -102,7 +102,7 @@ class Mangahere(context: Context, override val id: Int) : ParsedOnlineSource(con } override fun pageListParse(document: Document, pages: MutableList) { - document.select("select.wid60").first().getElementsByTag("option").forEach { + document.select("select.wid60").first()?.getElementsByTag("option")?.forEach { pages.add(Page(pages.size, it.attr("value"))) } pages.getOrNull(0)?.imageUrl = imageUrlParse(document)