From db01f456b1ea2308c50cba5a7c9dd71d2fc84c4b Mon Sep 17 00:00:00 2001 From: thibault allenet <thibault.allenet@cea.fr> Date: Thu, 3 Aug 2023 12:55:10 +0000 Subject: [PATCH] Add execption in replaceWith for non existing input nodes --- src/graph/GraphView.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index 1b4b1a511..e0fa89237 100644 --- a/src/graph/GraphView.cpp +++ b/src/graph/GraphView.cpp @@ -575,13 +575,14 @@ bool Aidge::GraphView::replaceWith(std::set<std::shared_ptr<Node>> newNodes) { for (auto& nodePtr : copyNode) { nodePtr->resetConnections(true); } // copy output connections - for (IONb_t o = 0; o < previousOutputNode->nbOutputs(); ++o) { - auto outputPairs = copyOutputs[o]; - for (const auto& onePair : outputPairs) { - newOutputNode->addChild(onePair.first, o, onePair.second); + if (newOutputNode) { + for (IONb_t o = 0; o < previousOutputNode->nbOutputs(); ++o) { + auto outputPairs = copyOutputs[o]; + for (const auto& onePair : outputPairs) { + newOutputNode->addChild(onePair.first, o, onePair.second); + } } } - // insert new Nodes in the right GraphViews for (auto& graphPtr : commonGraphViews) { graphPtr->add(newNodes, false); -- GitLab