mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-06 01:13:41 +02:00
Fix exceptions when referencing invalid fields XXX_index
This commit is contained in:
parent
b4f9c302a5
commit
77284f7528
1 changed files with 3 additions and 1 deletions
|
|
@ -501,13 +501,15 @@ def format_field_extended(self, key, series_with_index=True):
|
|||
if key.startswith('#') and key.endswith('_index'):
|
||||
tkey = key[:-6] # strip the _index
|
||||
cmeta = self.get_user_metadata(tkey, make_copy=False)
|
||||
if cmeta['datatype'] == 'series':
|
||||
if cmeta and cmeta['datatype'] == 'series':
|
||||
if self.get(tkey):
|
||||
res = self.get_extra(tkey)
|
||||
return (unicode(cmeta['name']+'_index'),
|
||||
self.format_series_index(res), res, cmeta)
|
||||
else:
|
||||
return (unicode(cmeta['name']+'_index'), '', '', cmeta)
|
||||
else:
|
||||
return (key, key, None, None)
|
||||
|
||||
if key in self.custom_field_keys():
|
||||
res = self.get(key, None)
|
||||
|
|
|
|||
Loading…
Reference in a new issue