From: johanengelen Date: Thu, 11 Sep 2008 22:03:22 +0000 (+0000) Subject: fix curve::penultimate_point old behavior. no longer triggers 2geom exception. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3635bfb1c0d2615b6715160231272e6d774cae97;p=inkscape.git fix curve::penultimate_point old behavior. no longer triggers 2geom exception. --- 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 SPCurve::penultimate_point() const { boost::optional 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;