From 14d1048594b6ed3f2f97c5205de4969dda4c5e0e Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Wed, 5 Nov 2014 15:03:09 +0100
Subject: [PATCH] WaypointEdge::build does not return a cascade of PathVector

---
 src/graph/edge.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/graph/edge.cc b/src/graph/edge.cc
index 6e4214d..7a66ad0 100644
--- a/src/graph/edge.cc
+++ b/src/graph/edge.cc
@@ -197,9 +197,12 @@ namespace hpp {
           return false;
         if (!waypoint_.first->build (pathToWaypoint, q1, config_, d))
           return false;
-        core::PathVectorPtr_t pv = core::PathVector::create (graph_.lock ()->robot ()->configSize ());
+        core::PathVectorPtr_t pv = HPP_DYNAMIC_PTR_CAST (core::PathVector, pathToWaypoint);
+        if (!pv) {
+          pv = core::PathVector::create (graph_.lock ()->robot ()->configSize ());
+          pv->appendPath (pathToWaypoint);
+        }
         path = pv;
-        pv->appendPath (pathToWaypoint);
 
         core::PathPtr_t end;
         if (!Edge::build (end, config_, q2, d))
-- 
GitLab