dnn/NGraph: added nullptr checks
authorMaksim Shabunin <maksim.shabunin@gmail.com>
Mon, 8 Jun 2020 18:57:27 +0000 (21:57 +0300)
committerMaksim Shabunin <maksim.shabunin@gmail.com>
Tue, 9 Jun 2020 08:10:36 +0000 (11:10 +0300)
modules/dnn/src/dnn.cpp

index 6190112..ee6b7b1 100644 (file)
@@ -2158,6 +2158,7 @@ struct Net::Impl : public detail::NetImplBase
                         Ptr<BackendNode> inpNode = inpLd.backendNodes[preferableBackend];
                         if (!inpNode.empty()) {
                             Ptr<InfEngineNgraphNode> ieNode = inpNode.dynamicCast<InfEngineNgraphNode>();
+                            CV_Assert(!ieNode.empty());
                             ieNode->net->setUnconnectedNodes(ieNode);
                         }
                     }
@@ -2202,6 +2203,7 @@ struct Net::Impl : public detail::NetImplBase
                         int cons_inp = cons->oid;
                         Ptr<NgraphBackendWrapper> inpWrapper = inpLd.outputBlobsWrappers[cons_inp].
                                                                      dynamicCast<NgraphBackendWrapper>();
+                        CV_Assert(!inpWrapper.empty());
                         auto iter = std::find(inputNames.begin(), inputNames.end(),
                                               inpWrapper->dataPtr->getName());
                         if (iter == inputNames.end()) {