summaryrefslogtreecommitdiffstats
path: root/src/display/curve.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/display/curve.cpp')
-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;