Fix #2066 (AttributeError: 'BookHeader' object has no attribute 'first_image_index')

This commit is contained in:
Kovid Goyal 2009-03-15 12:09:33 -07:00
parent 04f0e389af
commit 7294199798

View File

@ -89,6 +89,8 @@ class BookHeader(object):
self.sublanguage = 'NEUTRAL' self.sublanguage = 'NEUTRAL'
self.exth_flag, self.exth = 0, None self.exth_flag, self.exth = 0, None
self.ancient = True self.ancient = True
self.first_image_index = -1
self.mobi_version = 1
else: else:
self.ancient = False self.ancient = False
self.doctype = raw[16:20] self.doctype = raw[16:20]
@ -519,7 +521,7 @@ class MobiReader(object):
os.makedirs(output_dir) os.makedirs(output_dir)
image_index = 0 image_index = 0
self.image_names = [] self.image_names = []
start = self.book_header.first_image_index start = getattr(self.book_header, 'first_image_index', -1)
if start > self.num_sections or start < 0: if start > self.num_sections or start < 0:
# BAEN PRC files have bad headers # BAEN PRC files have bad headers
start=0 start=0