Browse Source

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 years ago
parent
commit
4b39939436
1 changed files with 6 additions and 1 deletions
  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))
         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 \
         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 "
             dlg = wx.MessageDialog(parent, message=_("Vector map <%s> already exists "
                                                      "in the current mapset. "
                                                      "in the current mapset. "
                                                      "Do you want to overwrite it?") % outmap,
                                                      "Do you want to overwrite it?") % outmap,