mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
newdb: Do not error out if the db contains null entries in the authors table
This commit is contained in:
parent
6908eea3e9
commit
e933f57798
@ -1289,11 +1289,15 @@ class Cache(object):
|
||||
string. '''
|
||||
table = self.fields['authors'].table
|
||||
result = []
|
||||
try:
|
||||
rmap = {icu_lower(v):k for k, v in table.id_map.iteritems()}
|
||||
except AttributeError:
|
||||
# Somehow, the authors table has some authors that are None. Corrupted db?
|
||||
rmap = {icu_lower(v or ''):k for k, v in table.id_map.iteritems()}
|
||||
for aut in authors:
|
||||
aid = rmap.get(icu_lower(aut), None)
|
||||
result.append(author_to_author_sort(aut) if aid is None else table.asort_map[aid])
|
||||
return ' & '.join(result)
|
||||
return ' & '.join(filter(None, result))
|
||||
|
||||
@read_api
|
||||
def has_book(self, mi):
|
||||
|
Loading…
x
Reference in New Issue
Block a user