From: Johan Engelen Date: Sat, 23 Oct 2010 21:07:35 +0000 (+0200) Subject: Beware: some 2geom functions can throw useful exceptions! fixing crash bug 614751 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=55a286f813676c0fa501867047da87af2291384e;p=inkscape.git Beware: some 2geom functions can throw useful exceptions! fixing crash bug 614751 --- diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 4d765af99..24790c657 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -24,6 +24,7 @@ #include <2geom/transforms.h> #include <2geom/pathvector.h> #include <2geom/path-intersection.h> +#include <2geom/exception.h> #include "helper/geom.h" #include "helper/geom-nodetype.h" @@ -1272,13 +1273,19 @@ static void sp_shape_snappoints(SPItem const *item, std::vectorgetSnapIntersectionCS()) { Geom::Crossings cs; - cs = self_crossings(*path_it); - if (cs.size() > 0) { // There might be multiple intersections... - for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { - Geom::Point p_ix = (*path_it).pointAt((*i).ta); - p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2d, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); + try { + cs = self_crossings(*path_it); + if (cs.size() > 0) { // There might be multiple intersections... + for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { + Geom::Point p_ix = (*path_it).pointAt((*i).ta); + p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2d, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); + } } + } catch (Geom::RangeError &e) { + // do nothing + // The exception could be Geom::InfiniteSolutions: then no snappoints should be added } + } }