summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-09-11 22:03:22 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-09-11 22:03:22 +0000
commit5224ebedb0bfeb918a55a4830d87404713e66969 (patch)
tree3fdbdc3b38ff44b0704130b056e5d2b3d1a22d5f /src
parentconvert almost all libnrtype to Geom:: (diff)
downloadinkscape-5224ebedb0bfeb918a55a4830d87404713e66969.tar.gz
inkscape-5224ebedb0bfeb918a55a4830d87404713e66969.zip
fix curve::penultimate_point old behavior. no longer triggers 2geom exception.
(bzr r6794)
Diffstat (limited to 'src')
-rw-r--r--src/display/curve.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 519def37d..0b560883b 100644
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
@@ -398,15 +398,20 @@ SPCurve::second_point() const
}
/**
- * TODO: fix comment: Return the second-last point of last subpath or _movePos if curve too short.
+ * Return the second-last point of last subpath or first point when that last subpath has only a moveto.
*/
boost::optional<Geom::Point>
SPCurve::penultimate_point() const
{
boost::optional<Geom::Point> retval;
if (!is_empty()) {
- Geom::Curve const& back = _pathv.back().back_default();
- retval = back.initialPoint();
+ Geom::Path const &lastpath = _pathv.back();
+ if (!lastpath.empty()) {
+ Geom::Curve const &back = lastpath.back_default();
+ retval = back.initialPoint();
+ } else {
+ retval = lastpath.initialPoint();
+ }
}
return retval;