From 3843f661de657f641e5b6e0762fcd6cba0db8341 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 16 Aug 2021 06:45:38 +0530 Subject: [PATCH] Library model: Dont raise exceptions on invalid QModelIndexes --- src/calibre/gui2/library/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 94d82de708..4753d20a47 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -909,7 +909,7 @@ class BooksModel(QAbstractTableModel): # {{{ # in obscure cases where custom columns are both edited and added, for a time # the column map does not accurately represent the screen. In these cases, # we will get asked to display columns we don't know about. Must test for this. - if col >= len(self.column_to_dc_map): + if col >= len(self.column_to_dc_map) or col < 0: return None if role == Qt.ItemDataRole.DisplayRole: rules = self.db.new_api.pref('column_icon_rules')