diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index 1eb1055966..c7ed6a4c17 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -2023,6 +2023,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); } } @@ -2067,6 +2068,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()) {