diff --git a/interfaces/kits/js/src/common/ani_helper/type_converter.cpp b/interfaces/kits/js/src/common/ani_helper/type_converter.cpp index 662006f953758d7a46e3c4f93c76cbf5a17bcd2d..cbafc941ea0edea666c611a27091d8b5a64b684a 100644 --- a/interfaces/kits/js/src/common/ani_helper/type_converter.cpp +++ b/interfaces/kits/js/src/common/ani_helper/type_converter.cpp @@ -295,7 +295,9 @@ std::tuple TypeConverter::ToAniStringList( } ani_array result = nullptr; - if (env->Array_New(length, nullptr, &result) != ANI_OK) { + ani_ref undefined; + env->GetUndefined(&undefined); + if (env->Array_New(length, undefined, &result) != ANI_OK) { return { false, result }; } for (uint32_t i = 0; i < length; i++) { diff --git a/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp b/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp index 79a94260deb339a9259a643134bd87449b8f4abb..84dd373c18c0a24b82150c56f31084059454fa98 100644 --- a/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp @@ -129,8 +129,8 @@ tuple>> ParseArrayString(ani_env *env, ani_object return { true, nullopt }; } - ani_double length; - if (ANI_OK != env->Object_GetPropertyByName_Double( + ani_int length; + if (ANI_OK != env->Object_GetPropertyByName_Int( static_cast(resultRef), "length", &length) || length == 0) { return { false, nullopt }; }