From 5c02e89c9311e94068071efc8ed71df1b56fe20b Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Fri, 13 Sep 2024 10:38:07 +0200 Subject: [PATCH] Hotfix for possible segfault --- src/graph/GraphView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index d23137655..5a3eb695d 100644 --- a/src/graph/GraphView.cpp +++ b/src/graph/GraphView.cpp @@ -650,9 +650,12 @@ void Aidge::GraphView::add(std::shared_ptr<Node> node, bool includeLearnablePara std::pair<std::vector<Aidge::NodePtr>, size_t> Aidge::GraphView::getRankedNodes() const { std::set<NodePtr> nodesToRank(mNodes); - nodesToRank.erase(mRootNode); std::vector<NodePtr> rankedNodes; - rankedNodes.push_back(mRootNode); + + if (mRootNode) { + nodesToRank.erase(mRootNode); + rankedNodes.push_back(mRootNode); + } for (size_t curNodeIdx = 0; curNodeIdx < rankedNodes.size(); ++curNodeIdx) { NodePtr curNode = rankedNodes[curNodeIdx]; -- GitLab