diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-09-11 22:03:22 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-09-11 22:03:22 +0000 |
| commit | 5224ebedb0bfeb918a55a4830d87404713e66969 (patch) | |
| tree | 3fdbdc3b38ff44b0704130b056e5d2b3d1a22d5f /src/display/curve.cpp | |
| parent | convert almost all libnrtype to Geom:: (diff) | |
| download | inkscape-5224ebedb0bfeb918a55a4830d87404713e66969.tar.gz inkscape-5224ebedb0bfeb918a55a4830d87404713e66969.zip | |
fix curve::penultimate_point old behavior. no longer triggers 2geom exception.
(bzr r6794)
Diffstat (limited to 'src/display/curve.cpp')
| -rw-r--r-- | src/display/curve.cpp | 11 |
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; |
