[GRASS-SVN] r43391 -
grass/branches/releasebranch_6_4/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 3 08:54:39 EDT 2010
Author: mmetz
Date: 2010-09-03 12:54:39 +0000 (Fri, 03 Sep 2010)
New Revision: 43391
Modified:
grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c
Log:
fix segfault when cleaning small angles at nodes
Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c 2010-09-01 22:14:41 UTC (rev 43390)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c 2010-09-03 12:54:39 UTC (rev 43391)
@@ -61,7 +61,6 @@
int line1 = -999; /* value not important, just for debug */
int clean = 1;
-
nlines = Vect_get_node_n_lines(Map, node);
G_debug(3, "nlines = %d", nlines);
@@ -162,6 +161,10 @@
Vect_line_delete_point(Points, Points->n_points - 1); /* last */
}
+ /* It may happen that it is one line: node could be deleted,
+ * in that case we have to read the node coords first */
+ Vect_get_node_coor(Map, node, &nx, &ny, &nz);
+
if (Points->n_points > 1) {
new_short_line =
Vect_rewrite_line(Map, abs(short_line),
@@ -180,7 +183,6 @@
long_line = -new_short_line;
}
-
/* Add new line (must be before rewrite of long_line otherwise node could be deleted) */
long_type =
Vect_read_line(Map, NULL, LCats, abs(long_line));
@@ -200,7 +202,6 @@
type = GV_LINE;
}
- Vect_get_node_coor(Map, node, &nx, &ny, &nz);
Vect_reset_line(Points);
Vect_append_point(Points, nx, ny, nz);
Vect_append_point(Points, x, y, z);
@@ -242,7 +243,7 @@
angle1 = angle2;
}
- if (clean)
+ if (clean || !Vect_node_alive(Map, node))
break;
}
}
More information about the grass-commit
mailing list