epub: allow save even if cover is broken
authorNiki Roo <niki@nikiroo.be>
Sat, 25 May 2019 20:42:30 +0000 (22:42 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 25 May 2019 20:42:30 +0000 (22:42 +0200)
src/be/nikiroo/fanfix/output/Epub.java

index e3280d124fcfde473df65bb415805eaefbfab468..b7401d3922b2c182fd2ff1840ff1182986bd54cc 100644 (file)
@@ -136,8 +136,12 @@ class Epub extends BasicOutput {
                // OPS/images
                if (story.getMeta() != null && story.getMeta().getCover() != null) {
                        File file = new File(images, "cover");
-                       Instance.getCache().saveAsImage(story.getMeta().getCover(), file,
-                                       true);
+                       try {
+                               Instance.getCache().saveAsImage(story.getMeta().getCover(),
+                                               file, true);
+                       } catch (Exception e) {
+                               Instance.getTraceHandler().error(e);
+                       }
                }
 
                // OPS/* except chapters
@@ -437,7 +441,8 @@ class Epub extends BasicOutput {
 
                if (story.getMeta() != null && story.getMeta().getCover() != null) {
                        String format = Instance.getConfig()
-                                       .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
+                                       .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER)
+                                       .toLowerCase();
                        builder.append("\n      <item id=\"cover\" href=\"images/cover."
                                        + format + "\" media-type=\"image/png\"/>");
                }