diff --git a/fsl/fsleyes/controls/lookuptablepanel.py b/fsl/fsleyes/controls/lookuptablepanel.py index b9d44b05b8684de989f316b5cd83a81bfadd0f88..c7a5ad2e2dfaad174251387f019400cb46279887 100644 --- a/fsl/fsleyes/controls/lookuptablepanel.py +++ b/fsl/fsleyes/controls/lookuptablepanel.py @@ -243,16 +243,17 @@ class LookupTablePanel(fslpanel.FSLEyesPanel): def addLabel(labelIdx): - # A new request to re-create the list has - # been made - cancel this creation chain. - if self.__labelListCreateKey != myCreateKey: - return - # If the user closes this panel while the # label list is being created, wx will # complain when we try to append things # to a widget that has been destroyed. try: + + # A new request to re-create the list has + # been made - cancel this creation chain. + if self.__labelListCreateKey != myCreateKey: + return + label = lut.labels[labelIdx] widget = LabelWidget(self, lut, label.value())