[GRASS-SVN] r49226 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 14 03:13:33 EST 2011


Author: martinl
Date: 2011-11-14 00:13:33 -0800 (Mon, 14 Nov 2011)
New Revision: 49226

Modified:
   grass/trunk/lib/vector/Vlib/level_two.c
Log:
vlib: add more checks for Vect_get_centroid_area() 


Modified: grass/trunk/lib/vector/Vlib/level_two.c
===================================================================
--- grass/trunk/lib/vector/Vlib/level_two.c	2011-11-14 08:11:48 UTC (rev 49225)
+++ grass/trunk/lib/vector/Vlib/level_two.c	2011-11-14 08:13:33 UTC (rev 49226)
@@ -402,6 +402,12 @@
 	G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
 		      Vect_get_full_name(Map));
 
+    if (Map->plus.Line[centroid]->type != GV_CENTROID)
+	return 0;
+    
     topo = (struct P_topo_c *)Map->plus.Line[centroid]->topo;
+    if(!topo)
+	G_fatal_error(_("Topology info not available for feature %d"), centroid);
+    
     return (topo->area);
 }



More information about the grass-commit mailing list