[GRASS-SVN] r68764 - grass/trunk/vector/v.overlay

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 25 03:48:02 PDT 2016


Author: martinl
Date: 2016-06-25 03:48:02 -0700 (Sat, 25 Jun 2016)
New Revision: 68764

Modified:
   grass/trunk/vector/v.overlay/main.c
Log:
v.overlay: avoid fatal error (layer index invalid) when output map is empty and olayer=0,1,0

Modified: grass/trunk/vector/v.overlay/main.c
===================================================================
--- grass/trunk/vector/v.overlay/main.c	2016-06-25 01:56:02 UTC (rev 68763)
+++ grass/trunk/vector/v.overlay/main.c	2016-06-25 10:48:02 UTC (rev 68764)
@@ -11,7 +11,7 @@
  *               OGR support by Martin Landa <landa.martin gmail.com>
  *               Markus Metz
  * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2014 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2016 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
@@ -643,11 +643,14 @@
     struct ilist *list;
     int findex;
     
+    findex = Vect_cidx_get_field_index(Out, outfield);
+    if (findex < 0) 
+        return;
+
     list = Vect_new_list();
-    findex = Vect_cidx_get_field_index(Out, outfield);
-    
     Vect_cidx_get_unique_cats_by_index(Out, findex, list);
-    Vect_copy_table_by_cats(In, Out, infield, outfield, NULL, GV_MTABLE, list->value, list->n_values);
+    Vect_copy_table_by_cats(In, Out, infield, outfield, NULL,
+                            GV_MTABLE, list->value, list->n_values);
     
     Vect_destroy_list(list);
 }



More information about the grass-commit mailing list