From: Niki Roo Date: Tue, 23 Apr 2019 17:01:07 +0000 (+0200) Subject: FanfictionApi: fix NPE X-Git-Tag: fanfix-3.0.0~70^2 X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;ds=sidebyside;h=a5b424414ec03d932911cc2ea2be0d64fe25b0ef;hp=-c;p=fanfix.git FanfictionApi: fix NPE --- a5b424414ec03d932911cc2ea2be0d64fe25b0ef diff --git a/src/be/nikiroo/fanfix/supported/FimfictionApi.java b/src/be/nikiroo/fanfix/supported/FimfictionApi.java index 887f5f9..a64e4c0 100644 --- a/src/be/nikiroo/fanfix/supported/FimfictionApi.java +++ b/src/be/nikiroo/fanfix/supported/FimfictionApi.java @@ -145,10 +145,11 @@ class FimfictionApi extends BasicSupport { String coverImageLink = getKeyJson(json, 0, "type", "story", "cover_image", "full"); if (!coverImageLink.trim().isEmpty()) { - InputStream in = null; + URL coverImageUrl = new URL(coverImageLink.trim()); + + InputStream in = Instance.getCache() + .open(coverImageUrl, this, true); try { - URL coverImageUrl = new URL(coverImageLink.trim()); - in = Instance.getCache().open(coverImageUrl, this, true); meta.setCover(new Image(in)); } finally { in.close();