[GRASS-SVN] r33101 - grass/branches/develbranch_6/vector/v.extrude

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 26 17:40:14 EDT 2008


Author: martinl
Date: 2008-08-26 17:40:12 -0400 (Tue, 26 Aug 2008)
New Revision: 33101

Modified:
   grass/branches/develbranch_6/vector/v.extrude/main.c
Log:
glynn: Catch null values returned from G_get_raster_sample()
(merge from devbr6, r33100)


Modified: grass/branches/develbranch_6/vector/v.extrude/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.extrude/main.c	2008-08-26 21:23:08 UTC (rev 33100)
+++ grass/branches/develbranch_6/vector/v.extrude/main.c	2008-08-26 21:40:12 UTC (rev 33101)
@@ -405,6 +405,9 @@
 	    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 (k == 0) {
 		voffset_dem = voffset_curr;
 	    }
@@ -415,9 +418,9 @@
 	}
     }
 
-    k = 0;
+    
     /* walls */
-    while (1) {
+    for (k = 0; ; k++) {
 	voffset_curr = voffset_next = 0.0;
 
 	/* trace */
@@ -425,11 +428,16 @@
 	    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;
 	    }
 	}
 
@@ -484,7 +492,6 @@
 	    if (k >= Points->n_points - 2)
 		break;
 	}
-	k++;
     }
 
     if (type & (GV_POINT | GV_LINE)) {



More information about the grass-commit mailing list