From 53ba32cbac6dc82dbc6a70a403222d72c9f577a4 Mon Sep 17 00:00:00 2001 From: zhuyinlin <1085905529@qq.com> Date: Tue, 29 Apr 2025 22:10:42 +0800 Subject: [PATCH] =?UTF-8?q?tensorImpl=20=E5=88=A4=E6=96=ADnullprt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuyinlin <1085905529@qq.com> --- .../native/neural_network_core/neural_network_core.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frameworks/native/neural_network_core/neural_network_core.cpp b/frameworks/native/neural_network_core/neural_network_core.cpp index fb1c313..33cd09d 100644 --- a/frameworks/native/neural_network_core/neural_network_core.cpp +++ b/frameworks/native/neural_network_core/neural_network_core.cpp @@ -1124,6 +1124,7 @@ NNRT_API NN_Tensor* OH_NNTensor_CreateWithFd(size_t deviceID, NNRT_API OH_NN_ReturnCode OH_NNTensor_Destroy(NN_Tensor **tensor) { + LOGI("start OH_NNTensor_Destroy"); if (tensor == nullptr) { LOGE("OH_NNTensor_Destroy failed, tensor is nullptr."); return OH_NN_INVALID_PARAMETER; @@ -1134,6 +1135,11 @@ NNRT_API OH_NN_ReturnCode OH_NNTensor_Destroy(NN_Tensor **tensor) } Tensor* tensorImpl = reinterpret_cast(*tensor); + if (tensorImpl == nullptr) { + LOGE("OH_NNTensor_Destroy failed, tensorImpl is nullptr."); + return OH_NN_NULL_PTR; + } + size_t backendID = tensorImpl->GetBackendID(); BackendManager& backendManager = BackendManager::GetInstance(); std::shared_ptr backend = backendManager.GetBackend(backendID); -- Gitee