Assert if index is invalid in delete_cur_item.
CompletionView already checks the index, so an error here shouldn't happen.
This commit is contained in:
parent
fd07c571e5
commit
1e489325c4
@ -215,10 +215,10 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
|
|
||||||
def delete_cur_item(self, index):
|
def delete_cur_item(self, index):
|
||||||
"""Delete the row at the given index."""
|
"""Delete the row at the given index."""
|
||||||
|
qtutils.ensure_valid(index)
|
||||||
parent = index.parent()
|
parent = index.parent()
|
||||||
cat = self._cat_from_idx(parent)
|
cat = self._cat_from_idx(parent)
|
||||||
if not cat:
|
assert cat, "CompletionView sent invalid index for deletion"
|
||||||
raise cmdexc.CommandError("No category selected")
|
|
||||||
self.beginRemoveRows(parent, index.row(), index.row())
|
self.beginRemoveRows(parent, index.row(), index.row())
|
||||||
cat.delete_cur_item(cat.index(index.row(), 0))
|
cat.delete_cur_item(cat.index(index.row(), 0))
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
|
Loading…
Reference in New Issue
Block a user