From 9a3b91c6100088bfbefc918d15f6a09a3a6f8a5f Mon Sep 17 00:00:00 2001 From: tarsin Date: Wed, 17 May 2023 11:36:35 +0800 Subject: [PATCH] Cleanup thumbKey set TODO: make thumbKey field nonnull! --- .../hippo/ehviewer/client/parser/GalleryListParser.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.kt b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.kt index edd972813..92d4bb0fd 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.kt +++ b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryListParser.kt @@ -141,6 +141,7 @@ object GalleryListParser { } // Thumb + var thumbUrl: String? = null val glthumb = JsoupUtils.getElementByClass(e, "glthumb") if (glthumb != null) { val img = glthumb.select("div:nth-child(1)>img").first() @@ -161,7 +162,7 @@ object GalleryListParser { url = img.attr("src") } if (url.isNotEmpty()) { - gi.thumbKey = EhUtils.handleThumbUrlResolution(url) + thumbUrl = EhUtils.handleThumbUrlResolution(url)!! } } @@ -175,7 +176,7 @@ object GalleryListParser { } } // Try extended and thumbnail version - if (gi.thumbKey == null) { + if (thumbUrl == null) { var gl = JsoupUtils.getElementByClass(e, "gl1e") if (gl == null) { gl = JsoupUtils.getElementByClass(e, "gl3t") @@ -193,12 +194,12 @@ object GalleryListParser { gi.thumbWidth = 0 gi.thumbHeight = 0 } - gi.thumbKey = EhUtils.handleThumbUrlResolution(img.attr("src")) + thumbUrl = EhUtils.handleThumbUrlResolution(img.attr("src")) } } } - gi.thumbKey = getThumbKey(gi.thumbKey!!) + gi.thumbKey = getThumbKey(thumbUrl!!) // Posted val posted = e.getElementById("posted_" + gi.gid)