[GRASS-SVN] r33118 - grass/trunk/vector/v.extrude

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 27 08:42:46 EDT 2008


Author: glynn
Date: 2008-08-27 08:42:42 -0400 (Wed, 27 Aug 2008)
New Revision: 33118

Modified:
   grass/trunk/vector/v.extrude/main.c
Log:
Fix null tests to handle loop termination correctly


Modified: grass/trunk/vector/v.extrude/main.c
===================================================================
--- grass/trunk/vector/v.extrude/main.c	2008-08-27 10:07:29 UTC (rev 33117)
+++ grass/trunk/vector/v.extrude/main.c	2008-08-27 12:42:42 UTC (rev 33118)
@@ -426,19 +426,30 @@
 	    voffset_curr = G_get_raster_sample(fdrast, &window, NULL,
 					       Points->y[k], Points->x[k], 0,
 					       NEAREST);
-	    if (G_is_d_null_value(&voffset_curr))
-		continue;
 
 	    if (type != GV_POINT) {
 		voffset_next = G_get_raster_sample(fdrast, &window, NULL,
 						   Points->y[k + 1],
 						   Points->x[k + 1], 0,
 						   NEAREST);
-		if (G_is_d_null_value(&voffset_next))
-		    continue;
 	    }
 	}
 
+	if (G_is_d_null_value(&voffset_curr) ||
+	    G_is_d_null_value(&voffset_next)) {
+	    if (type == GV_POINT)
+		break;
+	    else if (type == GV_LINE) {
+		if (k >= Points->n_points - 1)
+		    break;
+	    }
+	    else if (type & (GV_BOUNDARY | GV_AREA)) {
+		if (k >= Points->n_points - 2)
+		    break;
+	    }
+	    continue;
+	}
+
 	if (trace) {
 	    voffset_curr += voffset;
 	    voffset_next += voffset;



More information about the grass-commit mailing list