From: Niki Roo Date: Tue, 26 May 2020 19:00:00 +0000 (+0200) Subject: weblib: fix cover image close()d X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=5a6481dc6e87db089f93ef04bd03686916d42a88;p=fanfix.git weblib: fix cover image close()d --- diff --git a/src/be/nikiroo/fanfix/library/WebLibrary.java b/src/be/nikiroo/fanfix/library/WebLibrary.java index 9af38e2..7381ae3 100644 --- a/src/be/nikiroo/fanfix/library/WebLibrary.java +++ b/src/be/nikiroo/fanfix/library/WebLibrary.java @@ -173,12 +173,12 @@ public class WebLibrary extends BasicLibrary { InputStream in = post(WebLibraryUrls.getStoryUrlCover(luid)); try { Image img = new Image(in); - if (img.getSize() > 0) { + if (img.getSize() == 0) { img.close(); - return img; + img = null; } - return null; + return img; } finally { in.close(); } @@ -189,12 +189,12 @@ public class WebLibrary extends BasicLibrary { InputStream in = post(WebLibraryUrls.getCoverUrlSource(source)); try { Image img = new Image(in); - if (img.getSize() > 0) { + if (img.getSize() == 0) { img.close(); - return img; + img = null; } - return null; + return img; } finally { in.close(); } @@ -205,12 +205,12 @@ public class WebLibrary extends BasicLibrary { InputStream in = post(WebLibraryUrls.getCoverUrlAuthor(author)); try { Image img = new Image(in); - if (img.getSize() > 0) { + if (img.getSize() == 0) { img.close(); - return img; + img = null; } - return null; + return img; } finally { in.close(); }