!46354 【健壮性】imageAILoader

Merge pull request !46354 from 吴寅潇/fixImageAiCrash
This commit is contained in:
openharmony_ci 2024-11-04 11:47:30 +00:00 committed by Gitee
commit 430cfa3733
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -63,6 +63,10 @@ ImageAnalyzerInstance ImageAnalyzerLoader::CreateImageAnalyzer()
return {};
}
auto engine = OHOS::Ace::EngineHelper::GetCurrentEngine();
if (!engine) {
TAG_LOGW(AceLogTag::ACE_IMAGE, "ImageAnalyzer Create engine null.");
return {};
}
NativeEngine* nativeEngine = engine->GetNativeEngine();
auto env = reinterpret_cast<napi_env>(nativeEngine);
return { createImageAnalyzerInstance_(env), [lib = shared_from_this(),