weblib: fix cover image close()d
authorNiki Roo <niki@nikiroo.be>
Tue, 26 May 2020 19:00:00 +0000 (21:00 +0200)
committerNiki Roo <niki@nikiroo.be>
Tue, 26 May 2020 19:00:00 +0000 (21:00 +0200)
src/be/nikiroo/fanfix/library/WebLibrary.java

index 9af38e2b6bd1c7ccb565ca6f244e31ef42f40746..7381ae368661023aa3ac2a23c643d6f4461ac658 100644 (file)
@@ -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();
                }