浏览代码

wxGUI: don't fail on empty map when saving display

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42613 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年之前
父节点
当前提交
9fd9535830
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      gui/wxpython/gui_modules/mapdisp.py

+ 7 - 1
gui/wxpython/gui_modules/mapdisp.py

@@ -1171,7 +1171,13 @@ class MapFrame(wx.Frame):
             ltype = [{ 'ext' : 'ppm', 'type' : -1 },
                      { 'ext' : 'tif', 'type' : wx.BITMAP_TYPE_TIF }]
         else:
-            filetype, ltype = gdialogs.GetImageHandlers(self.MapWindow.img)
+            img = self.MapWindow.img
+            if not img:
+                gcmd.GMessage(parent = self,
+                              message = _("Nothing to render (empty map). Operation canceled."),
+                              msgType = 'info')
+                return
+            filetype, ltype = gdialogs.GetImageHandlers(img)
         
         # get size
         dlg = gdialogs.ImageSizeDialog(self)