From adb0df6d942a911ad2b642279c60e228a6f75745 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vitaliy=20Cherepanov/AI=20Tools=20Lab=20/SRR/Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 10 Aug 2018 12:13:38 +0300 Subject: [PATCH] IR graph: Fix getInput/getOutput (#949) add checking of map search results Signed-off-by: Vitaliy Cherepanov --- contrib/nnc/libs/core/src/core/IR/model/graph/graph.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contrib/nnc/libs/core/src/core/IR/model/graph/graph.cpp b/contrib/nnc/libs/core/src/core/IR/model/graph/graph.cpp index a2f0f80..4167992 100644 --- a/contrib/nnc/libs/core/src/core/IR/model/graph/graph.cpp +++ b/contrib/nnc/libs/core/src/core/IR/model/graph/graph.cpp @@ -16,11 +16,19 @@ namespace IR namespace model { INode::Ref Graph::getInput(const std::string &name) { - return _inputs.find(name)->second; + auto it = _inputs.find(name); + if (it == _inputs.end()) + return nullptr; + else + return it->second; } INode::Ref Graph::getOutput(const std::string &name) { - return _outputs.find(name)->second; + auto it = _outputs.find(name); + if (it == _outputs.end()) + return nullptr; + else + return it->second; } void Graph::accept(Visitor *visitor) { -- 2.7.4