From 69f6df71aec414a3ba6bfb0657e622f9e3b0b1f6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 21 Jul 2009 09:58:36 -0600 Subject: [PATCH] Fix periodicalize_toc to ignore empty books --- src/calibre/ebooks/mobi/output.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/mobi/output.py b/src/calibre/ebooks/mobi/output.py index 398854cab3..2a70ace6e3 100644 --- a/src/calibre/ebooks/mobi/output.py +++ b/src/calibre/ebooks/mobi/output.py @@ -89,6 +89,8 @@ class MOBIOutput(OutputFormatPlugin): def periodicalize_toc(self): from calibre.ebooks.oeb.base import TOC toc = self.oeb.toc + if not toc or len(self.oeb.spine) < 3: + return if toc and toc[0].klass != 'periodical': one, two = self.oeb.spine[0], self.oeb.spine[1] self.log('Converting TOC for MOBI periodical indexing...')