From cbbdf4d73f05bd80354b46f4d1b9972c57e4a401 Mon Sep 17 00:00:00 2001 From: liwang <965027894@qq.com> Date: Thu, 28 Aug 2025 18:25:21 +0800 Subject: [PATCH] =?UTF-8?q?sts=5Fcommon.cpp=E6=96=87=E4=BB=B6GetPropertyLo?= =?UTF-8?q?ng=E5=92=8CGetPropertyRefValue=E6=97=A5=E5=BF=97=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liwang <965027894@qq.com> --- frameworks/ets/ani/src/sts_common.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frameworks/ets/ani/src/sts_common.cpp b/frameworks/ets/ani/src/sts_common.cpp index 77f9cbce6..c4c719771 100644 --- a/frameworks/ets/ani/src/sts_common.cpp +++ b/frameworks/ets/ani/src/sts_common.cpp @@ -237,27 +237,33 @@ ani_status GetPropertyLong(ani_env *env, ani_object obj, const char *name, } if ((status = env->Object_CallMethodByName_Long(static_cast(refObj), "unboxed", ":l", &outvalue)) != ANI_OK) { - ANS_LOGE("Object_CallMethodByName_Boolean failed, status : %{public}d", status); + ANS_LOGE("Object_CallMethodByName_Long failed, status : %{public}d", status); return status; } - ANS_LOGD("Object_CallMethodByName_Long sucess"); + ANS_LOGD("GetPropertyLong sucess"); return status; } void GetPropertyRefValue(ani_env *env, ani_object obj, const char *name, ani_boolean &isUndefined, ani_ref &outRef) { if (env == nullptr || obj == nullptr || name == nullptr) { + ANS_LOGE("GetPropertyRefValue fail, has nullptr"); return; } outRef = nullptr; isUndefined = ANI_TRUE; - if (env->Object_GetPropertyByName_Ref(obj, name, &outRef) != ANI_OK) { + ani_status status = ANI_ERROR; + status = env->Object_GetPropertyByName_Ref(obj, name, &outRef); + if (status != ANI_OK) { + ANS_LOGE("Object_GetPropertyByName_Ref failed, status : %{public}d", status); return; } if (outRef == nullptr) { + ANS_LOGE("GetPropertyRefValue fail, outRef nullptr"); return; } env->Reference_IsUndefined(outRef, &isUndefined); + ANS_LOGD("GetPropertyRefValue end"); } ani_status GetPropertyRef(ani_env *env, ani_object obj, const char *name, ani_boolean &isUndefined, ani_ref &outRef) -- Gitee