From 7ce518106ba041f3cbb27cafda9eb670e5bb99f3 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Mon, 8 Jun 2020 21:57:27 +0300 Subject: [PATCH] dnn/NGraph: added nullptr checks --- modules/dnn/src/dnn.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index 6190112d67..ee6b7b1d43 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -2158,6 +2158,7 @@ struct Net::Impl : public detail::NetImplBase Ptr inpNode = inpLd.backendNodes[preferableBackend]; if (!inpNode.empty()) { Ptr ieNode = inpNode.dynamicCast(); + CV_Assert(!ieNode.empty()); ieNode->net->setUnconnectedNodes(ieNode); } } @@ -2202,6 +2203,7 @@ struct Net::Impl : public detail::NetImplBase int cons_inp = cons->oid; Ptr inpWrapper = inpLd.outputBlobsWrappers[cons_inp]. dynamicCast(); + CV_Assert(!inpWrapper.empty()); auto iter = std::find(inputNames.begin(), inputNames.end(), inpWrapper->dataPtr->getName()); if (iter == inputNames.end()) {