MOBI metadata: Handle cover/thumbnail exth fields with null pointers

MOBI metadata: Do not fail to set metadata in MOBI files if they have
EXTH fields with NULL pointers to a cover or thumbnail. Fixes #1205757 [Metadata edits not sticking](https://bugs.launchpad.net/calibre/+bug/1205757)
This commit is contained in:
Kovid Goyal 2013-07-28 09:34:58 +05:30
parent 694dfe5dc2
commit 7f3b6c1f7d

View File

@ -169,10 +169,11 @@ class MetadataUpdater(object):
self.timestamp = content
elif id == 201:
rindex, = self.cover_rindex, = unpack('>I', content)
self.cover_record = self.record(rindex + image_base)
if rindex != 0xffffffff:
self.cover_record = self.record(rindex + image_base)
elif id == 202:
rindex, = self.thumbnail_rindex, = unpack('>I', content)
if rindex > 0 :
if rindex > 0 and rindex != 0xffffffff:
self.thumbnail_record = self.record(rindex + image_base)
def patch(self, off, new_record0):