diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2010-10-23 21:07:35 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2010-10-23 21:07:35 +0000 |
| commit | 5566cfd9907a25b6c2167ae81933da8656b22f20 (patch) | |
| tree | 0675ca5a5b030cfaaeaf3f9e03c6d3eda84d89d7 /src/sp-shape.cpp | |
| parent | Fix updating for ellipses when viewbox is not defined (diff) | |
| download | inkscape-5566cfd9907a25b6c2167ae81933da8656b22f20.tar.gz inkscape-5566cfd9907a25b6c2167ae81933da8656b22f20.zip | |
Beware: some 2geom functions can throw useful exceptions! fixing crash bug 614751
Fixed bugs:
- https://launchpad.net/bugs/614751
(bzr r9845)
Diffstat (limited to 'src/sp-shape.cpp')
| -rw-r--r-- | src/sp-shape.cpp | 17 |
1 files 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::vector<Inkscape::SnapCa // (using "Method 1" as described in Inkscape::ObjectSnapper::_collectNodes()) if (snapprefs->getSnapIntersectionCS()) { 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 } + } } |
