Library model: Dont raise exceptions on invalid QModelIndexes

This commit is contained in:
Kovid Goyal 2021-08-16 06:45:38 +05:30
parent 05dba1cad5
commit 3843f661de
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -909,7 +909,7 @@ class BooksModel(QAbstractTableModel): # {{{
# in obscure cases where custom columns are both edited and added, for a time # 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, # 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. # 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 return None
if role == Qt.ItemDataRole.DisplayRole: if role == Qt.ItemDataRole.DisplayRole:
rules = self.db.new_api.pref('column_icon_rules') rules = self.db.new_api.pref('column_icon_rules')