Browse Source

i.group segfaults on empty input (fix https://trac.osgeo.org/grass/ticket/1705) (merge https://trac.osgeo.org/grass/changeset/69227 from trunk)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@69229 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 8 years ago
parent
commit
c04524b9dc
1 changed files with 4 additions and 0 deletions
  1. 4 0
      imagery/i.group/main.c

+ 4 - 0
imagery/i.group/main.c

@@ -215,6 +215,10 @@ static int add_or_update_group(char group[INAME_LEN], char **rasters, int k)
 
 
     for (m = 0; m < k; m++) {
     for (m = 0; m < k; m++) {
 	skip = 0;
 	skip = 0;
+        if (!rasters[m]) {
+            G_warning(_("No input raster maps defined"));
+            return 0;
+        }
 	if ((mapset = G_find_raster(rasters[m], "")) == NULL) {
 	if ((mapset = G_find_raster(rasters[m], "")) == NULL) {
 	    G_warning(_("Raster map <%s> not found. Skipped."), rasters[m]);
 	    G_warning(_("Raster map <%s> not found. Skipped."), rasters[m]);
             skip = 1;
             skip = 1;