Skip to content

Commit

Permalink
Make sure selection model exists before accessing (#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Jan 11, 2025
2 parents d5a35fa + d7d211b commit 70cca40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion novelwriter/gui/projtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,9 @@ def _onNodeExpanded(self, index: QModelIndex) -> None:
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]:
Expand Down

0 comments on commit 70cca40

Please sign in to comment.