Swallow index errors in the saved searches model as one user reports that they happen

This commit is contained in:
Kovid Goyal 2014-04-08 14:44:50 +05:30
parent 85e0882bbf
commit 7c77e5d21c

View File

@ -395,6 +395,7 @@ class SearchesModel(QAbstractListModel):
return len(self.filtered_searches)
def data(self, index, role):
try:
if role == Qt.DisplayRole:
search = self.searches[self.filtered_searches[index.row()]]
return QVariant(search['name'])
@ -405,6 +406,8 @@ class SearchesModel(QAbstractListModel):
if role == Qt.UserRole:
search = self.searches[self.filtered_searches[index.row()]]
return QVariant((self.filtered_searches[index.row()], search))
except IndexError:
pass
return NONE
def do_filter(self, text):