From 32d3a6703c577e6b909568da192263e23ae42d39 Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Wed, 15 Nov 2023 08:26:35 +0000
Subject: [PATCH] Update Connector to allow creation of incomplete graph
 (without a Producer at root)

---
 include/aidge/graph/Connector.hpp | 2 +-
 src/graph/Connector.cpp           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/aidge/graph/Connector.hpp b/include/aidge/graph/Connector.hpp
index 599ca7d6d..f123cbb34 100644
--- a/include/aidge/graph/Connector.hpp
+++ b/include/aidge/graph/Connector.hpp
@@ -83,4 +83,4 @@ class Connector {
 std::shared_ptr<GraphView> generateGraph(std::vector<Connector> ctors);
 }  // namespace Aidge
 
-#endif /* AIDGE_CORE_GRAPH_CONNECTOR_H_ */
\ No newline at end of file
+#endif /* AIDGE_CORE_GRAPH_CONNECTOR_H_ */
diff --git a/src/graph/Connector.cpp b/src/graph/Connector.cpp
index cd2ceff8b..98f58259a 100644
--- a/src/graph/Connector.cpp
+++ b/src/graph/Connector.cpp
@@ -41,6 +41,7 @@ std::shared_ptr<Aidge::GraphView> Aidge::generateGraph(std::vector<Connector> ct
             std::vector<std::shared_ptr<Node>> parents = nodesToAdd.back()->getParents();
             const std::set<std::shared_ptr<Node>>& alreadyAdded = graph->getNodes();
             for (std::shared_ptr<Node> parent : parents) {
+                if (!parent) continue;
                 if (alreadyAdded.find(parent) == alreadyAdded.end()) {
                     buffer.push_back(parent);
                 }
@@ -51,4 +52,4 @@ std::shared_ptr<Aidge::GraphView> Aidge::generateGraph(std::vector<Connector> ct
         buffer = {};
     }
     return graph;
-}
\ No newline at end of file
+}
-- 
GitLab