[hdf-compass] 117/295: add check for bad recent file history number

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.

commit 314dd012fbd50ef9769fa5fc43d894ee8189ba8c
Author: jreadey <jreadey at hdfgroup.org>
Date:   Thu Oct 8 00:25:53 2015 -0700

    add check for bad recent file history number
---
 hdf_compass/compass_viewer/frame.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hdf_compass/compass_viewer/frame.py b/hdf_compass/compass_viewer/frame.py
index f65523b..f8a48a5 100644
--- a/hdf_compass/compass_viewer/frame.py
+++ b/hdf_compass/compass_viewer/frame.py
@@ -178,9 +178,12 @@ class BaseFrame(wx.Frame):
 
         if not open_store(url):
             fileNum = evt.GetId() - wx.ID_FILE1
-            self.filehistory.RemoveFileFromHistory(fileNum)
-            self.filehistory.Save(self.config)
-            self.config.Flush()
+            if fileNum < 0 or fileNum >= MAX_RECENT_FILES:
+                print("Unexpected value for fileNum:" + str(fileNum))
+            else:  
+                self.filehistory.RemoveFileFromHistory(fileNum)
+                self.filehistory.Save(self.config)
+                self.config.Flush()
             dlg = wx.MessageDialog(self, 'The following file could not be opened:\n\n%s' % path,
                                    'No handler for file', wx.OK | wx.ICON_INFORMATION)
             dlg.ShowModal()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git



More information about the debian-science-commits mailing list