[GRASS-SVN] r51163 - grass/trunk/raster/r.watershed/ram
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 26 10:19:50 EDT 2012
Author: mmetz
Date: 2012-03-26 07:19:49 -0700 (Mon, 26 Mar 2012)
New Revision: 51163
Modified:
grass/trunk/raster/r.watershed/ram/close_maps2.c
Log:
r.watershed: add safety check
Modified: grass/trunk/raster/r.watershed/ram/close_maps2.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/close_maps2.c 2012-03-26 14:19:20 UTC (rev 51162)
+++ grass/trunk/raster/r.watershed/ram/close_maps2.c 2012-03-26 14:19:49 UTC (rev 51163)
@@ -27,7 +27,12 @@
max = n_basins;
G_debug(1, "%d basins created", max);
Rast_init_colors(&colors);
- Rast_make_random_colors(&colors, 1, max);
+ if (max > 0)
+ Rast_make_random_colors(&colors, 1, max);
+ else {
+ G_warning(_("No basins were created. Verify threshold and region settings."));
+ Rast_make_random_colors(&colors, 1, 2);
+ }
if (max < 1000) {
Rast_set_c_color((CELL) 0, 0, 0, 0, &colors);
More information about the grass-commit
mailing list