Only clear selection model if it exists

This commit is contained in:
Florian Bruhin 2014-04-15 17:16:28 +02:00
parent f959c0c137
commit 88b522fa16

View File

@ -288,8 +288,10 @@ class CompletionView(QTreeView):
@pyqtSlot()
def on_clear_completion_selection(self):
"""Clear the selection model when an item is activated."""
self.selectionModel().clearSelection()
self.selectionModel().clearCurrentIndex()
selmod = self.selectionModel()
if selmod is not None:
selmod.clearSelection()
selmod.clearCurrentIndex()
class _CompletionItemDelegate(QStyledItemDelegate):