Fix #1109 (Unhandled Error - Saving a file to an SD card)

This commit is contained in:
Kovid Goyal 2008-10-01 12:25:15 -07:00
parent 1aaafb6919
commit f55ff7d782
2 changed files with 5 additions and 2 deletions

View File

@ -326,7 +326,10 @@ class BooksModel(QAbstractTableModel):
ans = []
for row in (row.row() for row in rows):
format = None
db_formats = set(self.db.formats(row).lower().split(','))
fmts = self.db.formats(row)
if not fmts:
return []
db_formats = set(fmts.lower().split(','))
available_formats = set([f.lower() for f in formats])
u = available_formats.intersection(db_formats)
for f in formats:

View File

@ -577,7 +577,7 @@ class LibraryDatabase2(LibraryDatabase):
return set([f[0] for f in formats])
def formats(self, index, index_is_id=False):
''' Return available formats as a comma separated list or None if htere are no available formats '''
''' Return available formats as a comma separated list or None if there are no available formats '''
id = index if index_is_id else self.id(index)
path = os.path.join(self.library_path, self.path(id, index_is_id=True))
try: