Fix error if a marked book is deleted/merged.

Fixes #1239161 [Unhandled exception using "Mark books" feature](https://bugs.launchpad.net/calibre/+bug/1239161)
This commit is contained in:
Kovid Goyal 2013-10-12 22:35:15 +05:30
parent 0cfc152b05
commit 00e0901249

View File

@ -693,7 +693,13 @@ class BooksView(QTableView): # {{{
self.alternate_views.marked_changed(old_marked, current_marked)
if bool(old_marked) == bool(current_marked):
changed = old_marked | current_marked
sections = tuple(map(self.model().db.data.id_to_index, changed))
i = self.model().db.data.id_to_index
def f(x):
try:
return i(x)
except ValueError:
pass
sections = tuple(x for x in map(f, changed) if x is not None)
self.row_header.headerDataChanged(Qt.Vertical, min(sections), max(sections))
else:
# Marked items have either appeared or all been removed