From: Niki Roo Date: Wed, 15 Feb 2017 22:08:26 +0000 (+0100) Subject: Fix e621 getAuthor() which could error out X-Git-Tag: fanfix-0.9.4~3 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=7d0d2be6b0e9bd4e03ac8a7d749f49d6d1436242;p=fanfix.git Fix e621 getAuthor() which could error out --- diff --git a/src/be/nikiroo/fanfix/supported/E621.java b/src/be/nikiroo/fanfix/supported/E621.java index cb4ae46..45c110f 100644 --- a/src/be/nikiroo/fanfix/supported/E621.java +++ b/src/be/nikiroo/fanfix/supported/E621.java @@ -96,24 +96,28 @@ class E621 extends BasicSupport { author = author.substring(0, pos - 1); String page = source.getProtocol() + "://" + source.getHost() + author; - InputStream pageIn = Instance.getCache().open( - new URL(page), this, false); try { - key = "class=\"tag-type-artist\""; - author = getLine(pageIn, key, 0); - if (author != null) { - pos = author.indexOf("= 0) { - author = author.substring(pos); - pos = author.indexOf(""); + InputStream pageIn = Instance.getCache().open( + new URL(page), this, false); + try { + key = "class=\"tag-type-artist\""; + author = getLine(pageIn, key, 0); + if (author != null) { + pos = author.indexOf("= 0) { - author = author.substring(0, pos); - return StringUtils.unhtml(author); + author = author.substring(pos); + pos = author.indexOf(""); + if (pos >= 0) { + author = author.substring(0, pos); + return StringUtils.unhtml(author); + } } } + } finally { + pageIn.close(); } - } finally { - pageIn.close(); + } catch (Exception e) { + // No author found } } }