浏览代码

wxGUI: don't crash when no vector is in the current mapset
(merge from devbr6, https://trac.osgeo.org/grass/changeset/32898)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32899 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 17 年之前
父节点
当前提交
4b39939436
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      gui/wxpython/gui_modules/gdialogs.py

+ 6 - 1
gui/wxpython/gui_modules/gdialogs.py

@@ -128,8 +128,13 @@ def CreateNewVector(parent, cmdDef, title=_('Create new vector map'),
         
         cmd.append("%s=%s" % (cmdDef[1], outmap))
         
+        try:
+            listOfVector = grass.list_grouped('vect')[grass.gisenv()['MAPSET']]
+        except KeyError:
+            listOfVectors = []
+        
         if not UserSettings.Get(group='cmd', key='overwrite', subkey='enabled') and \
-                outmap in grass.list_grouped('vect')[grass.gisenv()['MAPSET']]:
+                outmap in listOfVectors:
             dlg = wx.MessageDialog(parent, message=_("Vector map <%s> already exists "
                                                      "in the current mapset. "
                                                      "Do you want to overwrite it?") % outmap,