Fix crash on delete of last record in list

This commit is contained in:
Tim Bentley 2009-06-05 17:24:42 +01:00
parent a9bad4aac7
commit 472ef981b6

View File

@ -59,6 +59,8 @@ class TextListData(QtCore.QAbstractListModel):
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
return QtCore.QVariant()
if role == QtCore.Qt.DisplayRole:
if row == self.rowCount(None):
row -= 1
retval = self.items[row][1]
else:
retval = QtCore.QVariant()