From 55a286f813676c0fa501867047da87af2291384e Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Sat, 23 Oct 2010 23:07:35 +0200 Subject: [PATCH] Beware: some 2geom functions can throw useful exceptions! fixing crash bug 614751 --- src/sp-shape.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 } + } } -- 2.30.2