From 0e2a5d2146e8b163e2ba575ab29f9f543d08be92 Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Wed, 15 Apr 2020 13:56:07 +0200
Subject: [PATCH] [GraphComponent] Throw only if this component is not
 initialized

  in throwIfNotInitialized.
  This modification allows users to access constraints of some edges during
  graph initialization, as soon as those edges are initialized.
---
 src/graph/graph-component.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/graph/graph-component.cc b/src/graph/graph-component.cc
index 1bed0069..b9188b8f 100644
--- a/src/graph/graph-component.cc
+++ b/src/graph/graph-component.cc
@@ -140,7 +140,10 @@ namespace hpp {
 
       void GraphComponent::throwIfNotInitialized () const
       {
-        if (!isInit_ || (graph_.lock() && !graph_.lock()->isInit_)) throw std::logic_error ("The graph should have been initialized first.");
+        if (!isInit_){
+          throw std::logic_error
+            ("The graph should have been initialized first.");
+        }
       }
 
       std::ostream& operator<< (std::ostream& os,
-- 
GitLab