From 25bbe84e61b3534b222870608cdd6aff6ff60f96 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Mon, 23 Jun 2014 12:29:09 +0100
Subject: [PATCH] Guards in locationpanel.py property listeners, for when the
 image list is empty.

---
 fsl/fslview/locationpanel.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fsl/fslview/locationpanel.py b/fsl/fslview/locationpanel.py
index 6a19e03b0..acfa98aef 100644
--- a/fsl/fslview/locationpanel.py
+++ b/fsl/fslview/locationpanel.py
@@ -148,6 +148,8 @@ class LocationPanel(wx.Panel, props.HasProperties):
         selected image.
         """
 
+        if len(self.imageList) == 0: return
+
         image  = self.imageList[self.imageList.selectedImage]
         loc    = self.imageList.location.xyz
         voxLoc = image.worldToVox([loc])[0]
@@ -168,6 +170,8 @@ class LocationPanel(wx.Panel, props.HasProperties):
         (which contains the image name), and sets the voxel location limits.
         """
 
+        if len(self.imageList) == 0: return
+
         image = self.imageList[self.imageList.selectedImage]
         
         self._voxelLabel.SetLabel('Voxel coordinates ({})'.format(image.name))
-- 
GitLab