!1149 解引用nullptr告警处理

Merge pull request !1149 from stepend98/cherry-pick-1727058599
This commit is contained in:
openharmony_ci 2024-09-26 04:02:36 +00:00 committed by Gitee
commit 280218b809
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -133,6 +133,10 @@ void JsStaticSubscriberExtension::ExecNapiWrap(napi_env env, napi_value obj)
napi_value contextObj = CreateJsStaticSubscriberExtensionContext(env, context);
auto shellContextRef = AbilityRuntime::JsRuntime::LoadSystemModuleByEngine(
env, "application.StaticSubscriberExtensionContext", &contextObj, ARGC_ONE);
if (shellContextRef == nullptr) {
EVENT_LOGE("Failed to get shell context reference");
return;
}
napi_value nativeObj = shellContextRef->GetNapiValue();
if (nativeObj == nullptr) {
EVENT_LOGE("Failed to get context native object");