[GRASS-SVN] r65962 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 18 04:08:33 PDT 2015


Author: neteler
Date: 2015-08-18 04:08:33 -0700 (Tue, 18 Aug 2015)
New Revision: 65962

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

Modified: grass/trunk/lib/gis/get_window.c
===================================================================
--- grass/trunk/lib/gis/get_window.c	2015-08-18 10:59:52 UTC (rev 65961)
+++ grass/trunk/lib/gis/get_window.c	2015-08-18 11:08:33 UTC (rev 65962)
@@ -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