Parcourir la source

wxGUI/gmodeler: errors when changing order of commands (indexation of items seems wrong) (merge https://trac.osgeo.org/grass/changeset/68198 from trunk) https://trac.osgeo.org/grass/ticket/2836

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@68199 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa il y a 9 ans
Parent
commit
f2ee8c2284
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      gui/wxpython/gmodeler/model.py

+ 4 - 1
gui/wxpython/gmodeler/model.py

@@ -120,7 +120,10 @@ class Model(object):
             item = self.items.pop(oldIdx)
             item = self.items.pop(oldIdx)
             items.append(item)
             items.append(item)
             self.items.insert(newIdx, item)
             self.items.insert(newIdx, item)
-            nextItem = self.items[newIdx+1]
+            try:
+                nextItem = self.items[newIdx+1]
+            except IndexError:
+                continue # newIdx is the last item in the list
             items.append(nextItem)
             items.append(nextItem)
             x = item.GetX()
             x = item.GetX()
             y = item.GetY()
             y = item.GetY()