X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FBasicSupportImages.java;h=f56b50c2b67a6dd9f5a4b1e0de572767d0a42dde;hb=0a264fbe3d5a43516006052574a5f322d9d38897;hp=4b7eeba36574f084ee6c044b1d1dd4ced798416e;hpb=0013f760d69fd7db2b298c3da5d89bc0b102eabf;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/BasicSupportImages.java b/src/be/nikiroo/fanfix/supported/BasicSupportImages.java index 4b7eeba..f56b50c 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupportImages.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupportImages.java @@ -54,8 +54,14 @@ public class BasicSupportImages { } InputStream in = null; try { - in = Instance.getCache().open(url, support, true); - return new Image(in); + in = Instance.getInstance().getCache().open(url, support, true); + Image img = new Image(in); + if (img.getSize() == 0) { + img.close(); + throw new IOException( + "Empty image not accepted"); + } + return img; } catch (IOException e) { } finally { if (in != null) { @@ -126,7 +132,7 @@ public class BasicSupportImages { // try for URLs try { for (String ext : getImageExt(true)) { - if (Instance.getCache() + if (Instance.getInstance().getCache() .check(new URL(line + ext), true)) { url = new URL(line + ext); break; @@ -138,7 +144,7 @@ public class BasicSupportImages { for (String ext : getImageExt(true)) { try { url = new URL(line + ext); - Instance.getCache().refresh(url, support, true); + Instance.getInstance().getCache().refresh(url, support, true); break; } catch (IOException e) { // no image with this ext @@ -154,7 +160,7 @@ public class BasicSupportImages { // refresh the cached file if (url != null) { try { - Instance.getCache().refresh(url, support, true); + Instance.getInstance().getCache().refresh(url, support, true); } catch (IOException e) { // woops, broken image url = null;