From 2d917ba220c76b107b9bc2b7750e9e0af0c1dfa3 Mon Sep 17 00:00:00 2001 From: trainstopperd Date: Fri, 28 Apr 2023 18:17:11 -0400 Subject: [PATCH] fix: accessing text when no quirks selected --- menus.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/menus.py b/menus.py index 6e3949f..98c9abe 100644 --- a/menus.py +++ b/menus.py @@ -112,6 +112,11 @@ class PesterQuirkList(QtWidgets.QTreeWidget): @QtCore.pyqtSlot() def upShiftQuirk(self): + # We cannot move the quirk up if there are no selected quirks, + # or if there are none period. + if self.currentItem() is None: + return + found = self.findItems( self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly ) @@ -150,6 +155,11 @@ class PesterQuirkList(QtWidgets.QTreeWidget): @QtCore.pyqtSlot() def downShiftQuirk(self): + # We cannot move the quirk down if there are no selected quirks, + # or if there are none period. + if self.currentItem() is None: + return + found = self.findItems( self.currentItem().text(0), QtCore.Qt.MatchFlag.MatchExactly )