fix problem that it was impossible to edit SFC jump, if it references non-existent SFC step
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 20 Dec 2016 14:41:10 +0300
changeset 1609 0d961dc6f58f
parent 1608 e8efeeb718ab
child 1610 31703a04789a
fix problem that it was impossible to edit SFC jump, if it references non-existent SFC step
editors/Viewer.py
--- a/editors/Viewer.py	Tue Dec 20 13:26:54 2016 +0300
+++ b/editors/Viewer.py	Tue Dec 20 14:41:10 2016 +0300
@@ -2962,7 +2962,12 @@
         dialog = wx.SingleChoiceDialog(self.ParentWindow,
               _("Edit jump target"), _("Please choose a target"),
               choices, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL)
-        dialog.SetSelection(choices.index(jump.GetTarget()))
+        try:
+            indx = choices.index(jump.GetTarget())
+            dialog.SetSelection(indx)
+        except ValueError:
+            pass
+
         if dialog.ShowModal() == wx.ID_OK:
             value = dialog.GetStringSelection()
             rect = jump.GetRedrawRect(1, 1)