summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3da8c9f)
raw | patch | inline | side by side (parent: 3da8c9f)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 11 Sep 2008 22:03:22 +0000 (22:03 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 11 Sep 2008 22:03:22 +0000 (22:03 +0000) |
src/display/curve.cpp | patch | blob | history |
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 519def37df5b34fd8d5d91070a67e080a730f792..0b560883bd367b2df6de89107e12821469e87fcd 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
}
/**
- * 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;