From 98c717625c7b4ee9e6c97fae57c80f3a5705f1b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 Jan 2010 20:25:21 -0700 Subject: [PATCH] MOBI Output: Don't die when converting EPUB files with SVG covers --- src/calibre/ebooks/oeb/stylizer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 26fb4ca980..3e7cca981e 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -119,7 +119,11 @@ class Stylizer(object): basename = os.path.basename(path) cssname = os.path.splitext(basename)[0] + '.css' stylesheets = [HTML_CSS_STYLESHEET] - head = xpath(tree, '/h:html/h:head')[0] + head = xpath(tree, '/h:html/h:head') + if head: + head = head[0] + else: + head = [] parser = cssutils.CSSParser(fetcher=self._fetch_css_file, log=logging.getLogger('calibre.css')) self.font_face_rules = []