summaryrefslogtreecommitdiffstats
path: root/src/sp-shape.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2007-12-03 18:41:40 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2007-12-03 18:41:40 +0000
commitff11b830d812479ef31e5ba05b85a4df2f1c6af0 (patch)
tree3fb1fcc9e13a21f562af63fab71f8a204e92cff4 /src/sp-shape.cpp
parent* [INTL: he] first translation by Leon Mintz (diff)
downloadinkscape-ff11b830d812479ef31e5ba05b85a4df2f1c6af0.tar.gz
inkscape-ff11b830d812479ef31e5ba05b85a4df2f1c6af0.zip
Solve crash on assert (see bugs #173555 and #173568 in launchpad)
(bzr r4162)
Diffstat (limited to 'src/sp-shape.cpp')
-rw-r--r--src/sp-shape.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index a0c2249c7..488dd9993 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -1127,19 +1127,16 @@ static void sp_shape_snappoints(SPItem const *item, SnapPointsIter p)
b++;
// Cycle through the subsequent nodes in the path
- while (b->code != NR_END) {
+ while (b->code == NR_LINETO || b->code == NR_CURVETO) {
pos = b->c(3) * i2d; // this is the current node
- g_assert(b->code == NR_LINETO || b->code == NR_CURVETO);
- g_assert(b[1].code == NR_LINETO || b[1].code == NR_CURVETO || b[1].code == NR_END);
-
if (b->code == NR_LINETO || b[1].code == NR_LINETO || b[1].code == NR_END) {
// end points of a line segment are always considered for snapping
*p = pos;
} else {
NR::Point ppos, npos;
- ppos = b->c(2) * i2d; // backward handle
- npos = b[1].c(1) * i2d; // forward handle
+ ppos = b->code == NR_CURVETO ? b->c(2) * i2d : pos; // backward handle
+ npos = b[1].code == NR_CURVETO ? b[1].c(1) * i2d : pos; // forward handle
// Determine whether a node is at a smooth part of the path, by
// calculating a measure for the collinearity of the handles