[GRASS-SVN] r70541 - grass/trunk/imagery/i.ortho.photo/i.ortho.photo

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 12 12:07:52 PST 2017


Author: ychemin
Date: 2017-02-12 12:07:52 -0800 (Sun, 12 Feb 2017)
New Revision: 70541

Modified:
   grass/trunk/imagery/i.ortho.photo/i.ortho.photo/menu.c
Log:
Added exception check for presence of group to allow creation by i.group

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.photo/menu.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.photo/menu.c	2017-02-12 19:48:11 UTC (rev 70540)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.photo/menu.c	2017-02-12 20:07:52 UTC (rev 70541)
@@ -48,7 +48,7 @@
     module->description = _("Menu driver for the photo imagery programs.");
 
     group_opt = G_define_standard_option(G_OPT_I_GROUP);
-    group_opt->required = NO;
+    group_opt->required = YES;
     group_opt->description =
 	_("Name of imagery group for ortho-rectification");
 
@@ -90,12 +90,15 @@
 	*p = 0;
 
     /* get and check the group reference files */
-    if (!I_get_group_ref(group.name, &group.group_ref))
-	G_fatal_error(_("Pre-selected group <%s> not found"), group.name);
-    I_get_group_ref(group.name, &group.group_ref);
+    /* Skip if you are creating the group right now */
+    if (strcmp(moduletorun, "i.group") != 0){
+    	if (!I_get_group_ref(group.name, &group.group_ref))
+		G_fatal_error(_("Pre-selected group <%s> not found"), group.name);
+	    I_get_group_ref(group.name, &group.group_ref);
 
-    if (group.group_ref.nfiles <= 0)
-	G_fatal_error(_("Group [%s] contains no files"), group.name);
+	    if (group.group_ref.nfiles <= 0)
+		G_fatal_error(_("Group [%s] contains no files"), group.name);
+    }
 
     I_put_group(group.name);
     /*-----------------------------*/



More information about the grass-commit mailing list