From 1d584c4ddd28280f5c9224175ce39aea9e690600 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 21 Mar 2014 00:16:02 +0100 Subject: control-point-selection : fix a (very unlikely) crash upon dereferencing unitialized bound variable (bzr r13176) --- src/ui/tool/control-point-selection.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index b5ee0a597..d10ed0f0d 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -194,6 +194,8 @@ void ControlPointSelection::align(Geom::Dim2 axis) bound.unionWith(Geom::OptInterval((*i)->position()[d])); } + if (!bound) { return; } + double new_coord = bound->middle(); for (iterator i = _points.begin(); i != _points.end(); ++i) { Geom::Point pos = (*i)->position(); @@ -220,6 +222,8 @@ void ControlPointSelection::distribute(Geom::Dim2 d) bound.unionWith(Geom::OptInterval(pos[d])); } + if (!bound) { return; } + // now we iterate over the multimap and set aligned positions. double step = size() == 1 ? 0 : bound->extent() / (size() - 1); double start = bound->min(); -- cgit v1.2.3 From 9df0bd626eed33451e8eeebffcb393fb7ae0f0d8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 22 Mar 2014 13:21:38 +0100 Subject: tool/node.cpp : don't rely on g_error terminating the program, allow more graceful error handling. (bzr r13183) --- src/ui/tool/node.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index e246bf997..fbbc4be64 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -1217,6 +1217,7 @@ Handle *Node::handleToward(Node *to) return back(); } g_error("Node::handleToward(): second node is not adjacent!"); + return NULL; } Node *Node::nodeToward(Handle *dir) @@ -1228,6 +1229,7 @@ Node *Node::nodeToward(Handle *dir) return _prev(); } g_error("Node::nodeToward(): handle is not a child of this node!"); + return NULL; } Handle *Node::handleAwayFrom(Node *to) @@ -1239,6 +1241,7 @@ Handle *Node::handleAwayFrom(Node *to) return front(); } g_error("Node::handleAwayFrom(): second node is not adjacent!"); + return NULL; } Node *Node::nodeAwayFrom(Handle *h) @@ -1250,6 +1253,7 @@ Node *Node::nodeAwayFrom(Handle *h) return _next(); } g_error("Node::nodeAwayFrom(): handle is not a child of this node!"); + return NULL; } Glib::ustring Node::_getTip(unsigned state) const -- cgit v1.2.3