From 7d0d2be6b0e9bd4e03ac8a7d749f49d6d1436242 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 15 Feb 2017 23:08:26 +0100 Subject: [PATCH] Fix e621 getAuthor() which could error out --- src/be/nikiroo/fanfix/supported/E621.java | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) 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 } } } -- 2.27.0