From b5503bf782da76b3e02d7aa0342e1e8eb8d32539 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Fri, 4 Mar 2016 16:40:38 +0000
Subject: [PATCH] Minor update to LookupTable create label list logic.

---
 fsl/fsleyes/controls/lookuptablepanel.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fsl/fsleyes/controls/lookuptablepanel.py b/fsl/fsleyes/controls/lookuptablepanel.py
index b9d44b05b..c7a5ad2e2 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())
                 
-- 
GitLab