Переглянути джерело

wxGUI/modeler: check validity of input file when loading

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67464 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 роки тому
батько
коміт
75c3aaed59
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      gui/wxpython/gmodeler/model.py

+ 7 - 0
gui/wxpython/gmodeler/model.py

@@ -1741,6 +1741,13 @@ class ProcessModelFile:
         """
         self.tree = tree
         self.root = self.tree.getroot()
+        # check if input is a valid GXM file
+        if self.root is None or self.root.tag != 'gxm':
+            if self.root is not None:
+                tagName = self.root.tag
+            else:
+                tabName = _("empty")
+            raise GException(_("Details: unsupported tag name '{}'.").format(tagName))
         
         # list of actions, data
         self.properties = dict()