# HG changeset patch # User Alpar Juttner # Date 1255358233 -3600 # Node ID f5f260a63a9b2c692a73c19b1713ea0b566b1172 # Parent b7e3662faf02cb4a397373a6f97f2942a9193b33# Parent 41bdb4d6c8c32c29a1eaebc3eef9bef7ef1f9862 Merge bugfix in #250 diff -r b7e3662faf02 -r f5f260a63a9b lemon/path.h --- a/lemon/path.h Mon Oct 05 20:21:54 2009 +0200 +++ b/lemon/path.h Mon Oct 12 15:37:13 2009 +0100 @@ -1015,18 +1015,20 @@ /// \brief The source of a path /// - /// This function returns the source of the given path. + /// This function returns the source node of the given path. + /// If the path is empty, then it returns \c INVALID. template typename Digraph::Node pathSource(const Digraph& digraph, const Path& path) { - return digraph.source(path.front()); + return path.empty() ? INVALID : digraph.source(path.front()); } /// \brief The target of a path /// - /// This function returns the target of the given path. + /// This function returns the target node of the given path. + /// If the path is empty, then it returns \c INVALID. template typename Digraph::Node pathTarget(const Digraph& digraph, const Path& path) { - return digraph.target(path.back()); + return path.empty() ? INVALID : digraph.target(path.back()); } /// \brief Class which helps to iterate through the nodes of a path