Bug on Enumerated DataType values defining fixed
authorlbessard
Wed, 26 Mar 2008 15:22:40 +0100
changeset 192 50926b8abac4
parent 191 d77f9b783ce8
child 193 e18e354a8006
Bug on Enumerated DataType values defining fixed
DataTypeEditor.py
--- a/DataTypeEditor.py	Tue Mar 25 18:43:48 2008 +0100
+++ b/DataTypeEditor.py	Wed Mar 26 15:22:40 2008 +0100
@@ -316,8 +316,10 @@
     
     def OnEnumeratedValueEndEdit(self, event):
         text = event.GetText()
-        if self.EnumeratedValues.GetStrings()[event.GetIndex()].upper() != text.upper():
-            if text.upper() in [string.upper() for string in self.EnumeratedValues.GetStrings()]:
+        values = self.EnumeratedValues.GetStrings()
+        index = event.GetIndex()
+        if index >= len(values) or values[index].upper() != text.upper():
+            if text.upper() in [value.upper() for value in values]:
                 message = wx.MessageDialog(self, "\"%s\" value already defined!"%text, "Error", wx.OK|wx.ICON_ERROR)
                 message.ShowModal()
                 message.Destroy()