From f93091952306baab27d5d7a0e0a75e5a996708b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 13 Jul 2009 18:08:42 -0600 Subject: [PATCH] Fix #2835 (Cover images not being sent to Kindle and mobi files not converting) --- src/calibre/ebooks/mobi/writer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 8e8cff2aff..5bd75d5e9a 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -1957,6 +1957,12 @@ class MobiWriter(object): # Test to see if this child's offset is the same as the previous child's # offset, skip it h = child.href + first = False + + if h is None: + self._oeb.logger.warn(' Ignoring TOC entry with no href:', + child.title) + continue currentOffset = self._id_offsets[h] # print "_generate_ctoc: child offset: 0x%X" % currentOffset @@ -1967,7 +1973,6 @@ class MobiWriter(object): else : self._oeb.logger.warn(" Ignoring redundant href: %s in '%s'" % (h, child.title)) - first = False else : if self.opts.verbose > 2 : self._oeb.logger.info("skipping class: %s depth %d at position %d" % \