Skip to content

Commit

Permalink
Fix error on reverting Qube Manager to an older version
Browse files Browse the repository at this point in the history
In rare case (when the Qube Manager was reverted to an older version
that does not have a column on which it was last sorted) downgrading
Qube Manager could result in a crash on start.
  • Loading branch information
marmarta committed Apr 3, 2019
1 parent ee8bce2 commit d2ad60e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,16 @@ def load_manager_settings(self):
self.sort_order = QtCore.Qt.SortOrder(
self.manager_settings.value("view/sort_order",
defaultValue=self.sort_order))
self.table.sortItems(self.columns_indices[self.sort_by_column],
self.sort_order)

try:
self.table.sortItems(self.columns_indices[self.sort_by_column],
self.sort_order)
except KeyError:
# the manager was sorted on a column that does not exist in the
# current version; possible only with downgrades
self.table.sortItems(self.columns_indices["Name"],
self.sort_order)

if not self.manager_settings.value("view/menubar_visible",
defaultValue=True):
self.action_menubar.setChecked(False)
Expand Down

0 comments on commit d2ad60e

Please sign in to comment.