X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=library%2FWebLibrary.java;h=ac1349e7ac51b3015050a4725a28265ef13a211a;hp=9d1c773aae698457d920b5094668eebb74605202;hb=159e970c23d9634d39bb8cf2a194f7088f4d59ab;hpb=4536c5cf2d7b8e68768f90d281b3e4974cd26ae9 diff --git a/library/WebLibrary.java b/library/WebLibrary.java index 9d1c773..ac1349e 100644 --- a/library/WebLibrary.java +++ b/library/WebLibrary.java @@ -152,7 +152,12 @@ public class WebLibrary extends BasicLibrary { public Image getCover(String luid) throws IOException { InputStream in = post(WebLibraryUrls.getStoryUrlCover(luid)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -162,7 +167,12 @@ public class WebLibrary extends BasicLibrary { public Image getCustomSourceCover(String source) throws IOException { InputStream in = post(WebLibraryUrls.getCoverUrlSource(source)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -172,7 +182,12 @@ public class WebLibrary extends BasicLibrary { public Image getCustomAuthorCover(String author) throws IOException { InputStream in = post(WebLibraryUrls.getCoverUrlAuthor(author)); try { - return new Image(in); + Image img = new Image(in); + if (img.getSize() > 0) { + return img; + } + + return null; } finally { in.close(); } @@ -223,7 +238,10 @@ public class WebLibrary extends BasicLibrary { InputStream subin = post( WebLibraryUrls.getStoryUrl(luid, chapNum, number)); try { - para.setContentImage(new Image(subin)); + Image img = new Image(subin); + if (img.getSize() > 0) { + para.setContentImage(img); + } } finally { subin.close(); } @@ -291,6 +309,8 @@ public class WebLibrary extends BasicLibrary { try { subPg = JsonIO.toProgress( new JSONObject(IOUtils.readSmallStream(in))); + } catch (Exception e) { + subPg = null; } finally { in.close(); }