From 8aed44dd76add97a25a964f5aacb1311fc88a00a Mon Sep 17 00:00:00 2001 From: Robb <35880555+robbwatershed@users.noreply.github.com> Date: Sat, 9 Sep 2023 15:20:21 +0200 Subject: [PATCH] More explicit error --- .../me/devsaki/hentoid/parsers/images/HitomiParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/me/devsaki/hentoid/parsers/images/HitomiParser.java b/app/src/main/java/me/devsaki/hentoid/parsers/images/HitomiParser.java index 476a4b85f..3f3859b5c 100644 --- a/app/src/main/java/me/devsaki/hentoid/parsers/images/HitomiParser.java +++ b/app/src/main/java/me/devsaki/hentoid/parsers/images/HitomiParser.java @@ -153,9 +153,11 @@ private String getJsPagesScript(@NonNull String galleryInfo) { private void updateContentInfo(@NonNull Content content, @NonNull String galleryInfoStr) throws Exception { int firstBrace = galleryInfoStr.indexOf("{"); int lastBrace = galleryInfoStr.lastIndexOf("}"); - String galleryJson = galleryInfoStr.substring(firstBrace, lastBrace + 1); - HitomiGalleryInfo galleryInfo = JsonHelper.jsonToObject(galleryJson, HitomiGalleryInfo.class); - galleryInfo.updateContent(content); + if (firstBrace > -1 && lastBrace > -1) { + String galleryJson = galleryInfoStr.substring(firstBrace, lastBrace + 1); + HitomiGalleryInfo galleryInfo = JsonHelper.jsonToObject(galleryJson, HitomiGalleryInfo.class); + galleryInfo.updateContent(content); + } else throw new EmptyResultException("Couldn't find gallery information"); } @Override