From: dvlierop2 Date: Mon, 3 Dec 2007 18:41:40 +0000 (+0000) Subject: Solve crash on assert (see bugs #173555 and #173568 in launchpad) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41c0784eb71dda1f20d5c4f2fd121851eb2793f4;p=inkscape.git Solve crash on assert (see bugs #173555 and #173568 in launchpad) --- 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