do not allow empty cover images
[fanfix.git] / src / be / nikiroo / fanfix / supported / BasicSupportHelper.java
index 7768052cafc758094e38c1968f5919f6b853b8bc..f3c30bc9657dfe1a70555d8104cd591ad3bf1523 100644 (file)
@@ -85,7 +85,13 @@ public class BasicSupportHelper {
                        InputStream in = null;
                        try {
                                in = Instance.getInstance().getCache().open(url, support, true);
-                               return new Image(in);
+                               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) {