From 42f012a8c54210bb81a4903a461582aee64c0ddb Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Sat, 14 May 2016 08:28:54 +0200
Subject: [PATCH] In Edge::build, call buildConstraint if steering method is
 not set.

  Calling method build before calling ProblemSolver::solve fails because
  steering method and probably constraints are not set.
---
 src/graph/edge.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/graph/edge.cc b/src/graph/edge.cc
index d447571f..d0330fe1 100644
--- a/src/graph/edge.cc
+++ b/src/graph/edge.cc
@@ -270,7 +270,16 @@ namespace hpp {
         if (!constraints->isSatisfied (q1) || !constraints->isSatisfied (q2)) {
           return false;
         }
-	path = (*steeringMethod_->get()) (q1, q2);
+	core::SteeringMethodPtr_t sm (steeringMethod_->get());
+	if (!sm) {
+	  buildPathConstraint ();
+	}
+	if (!sm) {
+	  std::ostringstream oss;
+	  oss << "No steering method set in edge " << name () << ".";
+	  throw std::runtime_error (oss.str ().c_str ());
+	}
+	path = (*sm) (q1, q2);
         return true;
       }
 
-- 
GitLab