From 25a536787b3421cfa8a3d99acf6fa3f6091c5cec Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Wed, 19 Aug 2015 16:16:24 +0100
Subject: [PATCH] Settings functions check to see if a wx.App exists, and do
 nothing if not.

---
 fsl/utils/settings.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fsl/utils/settings.py b/fsl/utils/settings.py
index 87b6c9ce6..9993a1478 100644
--- a/fsl/utils/settings.py
+++ b/fsl/utils/settings.py
@@ -14,6 +14,9 @@ def read(name, default=None):
     try:    import wx
     except: return None
 
+    if wx.GetApp() is None:
+        return None
+
     config = wx.Config('fsleyes')
     
     value = config.Read(name)
@@ -28,7 +31,10 @@ def read(name, default=None):
 def write(name, value):
 
     try:    import wx
-    except: return None    
+    except: return
+
+    if wx.GetApp() is None:
+        return 
 
     value  = str(value)
     config = wx.Config('fsleyes')
-- 
GitLab