From 654e27bb90879440335f265b69e2a3a5fb085eb2 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 12 May 2019 14:24:33 +0200 Subject: [PATCH] fix cbz import when no story --- src/be/nikiroo/fanfix/supported/Cbz.java | 34 +++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/be/nikiroo/fanfix/supported/Cbz.java b/src/be/nikiroo/fanfix/supported/Cbz.java index dfc1bbb..3da65ee 100644 --- a/src/be/nikiroo/fanfix/supported/Cbz.java +++ b/src/be/nikiroo/fanfix/supported/Cbz.java @@ -132,25 +132,27 @@ class Cbz extends Epub { story.setChapters(new ArrayList()); // Check if we can find non-images chapters, for hybrid-cbz support - for (Chapter chap : origStory) { - Boolean isImages = null; - for (Paragraph para : chap) { - ParagraphType t = para.getType(); - if (isImages == null && !t.isText(true)) { - isImages = true; - } - if (t.isText(false)) { - String line = para.getContent(); - // Images are saved in text mode as "[image-link]" - if (!(line.startsWith("[") && line.endsWith("]"))) { - isImages = false; + if (origStory != null) { + for (Chapter chap : origStory) { + Boolean isImages = null; + for (Paragraph para : chap) { + ParagraphType t = para.getType(); + if (isImages == null && !t.isText(true)) { + isImages = true; + } + if (t.isText(false)) { + String line = para.getContent(); + // Images are saved in text mode as "[image-link]" + if (!(line.startsWith("[") && line.endsWith("]"))) { + isImages = false; + } } } - } - if (isImages != null && !isImages) { - story.getChapters().add(chap); - chap.setNumber(story.getChapters().size()); + if (isImages != null && !isImages) { + story.getChapters().add(chap); + chap.setNumber(story.getChapters().size()); + } } } -- 2.27.0