[GRASS-SVN] r66125 - grass/branches/releasebranch_7_0/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 6 05:30:23 PDT 2015


Author: neteler
Date: 2015-09-06 05:30:22 -0700 (Sun, 06 Sep 2015)
New Revision: 66125

Modified:
   grass/branches/releasebranch_7_0/lib/gis/get_window.c
Log:
libgis: catch empty region file (suggested in https://lists.osgeo.org/pipermail/grass-dev/2015-August/075933.html) (trunk, r65962)

Modified: grass/branches/releasebranch_7_0/lib/gis/get_window.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/get_window.c	2015-09-06 12:28:47 UTC (rev 66124)
+++ grass/branches/releasebranch_7_0/lib/gis/get_window.c	2015-09-06 12:30:22 UTC (rev 66125)
@@ -118,6 +118,10 @@
 	G_fatal_error(_("Unable to open element file <%s> for <%s@%s>"),
 			element, name, mapset);
 
+    G_fseek(fp, 0, SEEK_END);
+    if (!G_ftell(fp))
+        G_fatal_error(_("Region file %s/%s/%s is empty"), mapset, element, name);
+    G_fseek(fp, 0, SEEK_SET);
     G__read_Cell_head(fp, window, 0);
     fclose(fp);
 }



More information about the grass-commit mailing list