[GRASS-SVN] r60413 - grass/branches/releasebranch_7_0/raster/r.surf.area
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu May 22 07:42:19 PDT 2014
Author: hcho
Date: 2014-05-22 07:42:19 -0700 (Thu, 22 May 2014)
New Revision: 60413
Modified:
grass/branches/releasebranch_7_0/raster/r.surf.area/main.c
Log:
r.surf.area: Fix segmentation fault and nan report with a single row map
Modified: grass/branches/releasebranch_7_0/raster/r.surf.area/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.surf.area/main.c 2014-05-22 14:41:24 UTC (rev 60412)
+++ grass/branches/releasebranch_7_0/raster/r.surf.area/main.c 2014-05-22 14:42:19 UTC (rev 60413)
@@ -131,8 +131,10 @@
top = bottom;
G_percent(row, w.rows, 10);
}
+
/* Get last null row area */
- add_null_area(top, &w, &nullarea);
+ if (w.rows > 1)
+ add_null_area(top, &w, &nullarea);
}
@@ -161,7 +163,9 @@
fprintf(stdout, "%s %f\n", _("Current region plan area:"),
conv_value(reg_area, units));
fprintf(stdout, "%s %f\n", _("Estimated region Surface Area:"),
- conv_value(reg_area * estavg / flat_area, units));
+ flat_area > 0 ?
+ conv_value(reg_area * estavg / flat_area, units) :
+ 0);
}
exit(EXIT_SUCCESS);
More information about the grass-commit
mailing list