Replaced try & catch with early exit on NoneType

This should fix the issue without exception handling.
This commit is contained in:
Tobias Frisch 2022-03-30 22:44:12 +02:00 committed by GitHub
parent 6fd6a68d9d
commit b859631a50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,9 +200,9 @@ class plotTreeView(QTreeWidget):
def mouseDoubleClickEvent(self, event):
item = self.currentItem()
if not item:
return
# Catching double clicks to forbid collapsing of toplevel items
try:
if item.parent():
QTreeWidget.mouseDoubleClickEvent(self, event)
except AttributeError:
pass
if item.parent():
QTreeWidget.mouseDoubleClickEvent(self, event)