diff --git a/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp b/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp index 3dd7f54fc4d4c8b1be098a120b8196f7a05af633..948cdbe7e3918d0cb3dd655e24c378331e2fd608 100644 --- a/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp +++ b/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp @@ -413,7 +413,15 @@ napi_value PluginRender::TestGetXComponentId(napi_env env, napi_callback_info in NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &thisArg, NULL)); status = napi_get_named_property(env, thisArg, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance); + if (status != napi_ok) { + return nullptr; + }; + status = napi_unwrap(env, exportInstance, reinterpret_cast(&nativeXComponent)); + if (status != napi_ok) { + return nullptr; + }; + ret = OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize); if (ret != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { return nullptr;