diff --git a/interfaces/kits/ani/common_event/src/ani_common_event_utils.cpp b/interfaces/kits/ani/common_event/src/ani_common_event_utils.cpp index f7e1355039e3bf2d798b8b6f3f52ecc933f75413..e82aef394071dd1dd5f619b350ac79acf506047b 100644 --- a/interfaces/kits/ani/common_event/src/ani_common_event_utils.cpp +++ b/interfaces/kits/ani/common_event/src/ani_common_event_utils.cpp @@ -58,15 +58,15 @@ ani_status AniCommonEventUtils::GetAniString(ani_env* env, const std::string str void AniCommonEventUtils::GetStdStringArrayClass(ani_env* env, ani_object arrayObj, std::vector& strings) { - ani_int length; + ani_double length; auto ret = ANI_ERROR; - ret = env->Object_GetPropertyByName_Int(arrayObj, "length", &length); + ret = env->Object_GetPropertyByName_Double(arrayObj, "length", &length); if (ret != ANI_OK) { EVENT_LOGE("GetStdStringArrayClass Object_GetPropertyByName_Double error. result: %{public}d.", ret); return; } - for (int32_t i = 0; i < length; i++) { + for (int32_t i = 0; i < static_cast(length); i++) { ani_ref stringEntryRef; ret = env->Object_CallMethodByName_Ref(arrayObj, "$_get", "I:Lstd/core/Object;", &stringEntryRef, i); if (ret != ANI_OK) {