Ignore invalid keys when applying saved sort order

This commit is contained in:
Kovid Goyal 2019-01-06 09:07:52 +05:30
parent 7fa1b3ffc0
commit cd69272e7d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -655,7 +655,10 @@ class BooksView(QTableView): # {{{
if self.is_library_view: if self.is_library_view:
for col, order in reversed(self.cleanup_sort_history( for col, order in reversed(self.cleanup_sort_history(
saved_history, ignore_column_map=True)[:max_sort_levels]): saved_history, ignore_column_map=True)[:max_sort_levels]):
self.sort_by_named_field(col, order) try:
self.sort_by_named_field(col, order)
except KeyError:
pass
else: else:
for col, order in reversed(self.cleanup_sort_history( for col, order in reversed(self.cleanup_sort_history(
saved_history)[:max_sort_levels]): saved_history)[:max_sort_levels]):