diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index ca5256b430..10f1ee32d6 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -185,7 +185,7 @@ class Serializer(object): buffer.write('') for ref in self.oeb.guide.values(): path = urldefrag(ref.href)[0] - if hrefs[path].media_type not in OEB_DOCS: + if path not in hrefs or hrefs[path].media_type not in OEB_DOCS: continue buffer.write('