Fix empty selection model bug (#2173)

This commit is contained in:
Veronica Berglyd Olsen
2025-01-11 18:35:07 +01:00
parent d5a35fa86f
commit d7d211baf2
+3 -1
View File
@@ -1020,7 +1020,9 @@ class GuiProjectTree(QTreeView):
def _clearSelection(self) -> None:
"""Clear the currently selected items."""
self.clearSelection()
self.selectionModel().clearCurrentIndex()
if model := self.selectionModel():
# Selection model can be None (#2173)
model.clearCurrentIndex()
return
def _selectedRows(self) -> list[QModelIndex]: