From 0d35e6695330624d308c8c9fb1c02be8b890923e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A1=BE=E5=86=AC=E6=B4=8B?= Date: Fri, 8 Aug 2025 08:57:03 +0800 Subject: [PATCH 1/2] handle listFile API failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 顾冬洋 --- interfaces/kits/js/src/mod_fs/properties/ani/listfile_ani.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 79a94260d..84dd373c1 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 }; } -- Gitee From f68fb462e6e118e61452688c41d703a6e703df41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A1=BE=E5=86=AC=E6=B4=8B?= Date: Tue, 12 Aug 2025 07:12:29 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9Array=5Fnew=E7=9A=84?= =?UTF-8?q?=E5=85=A5=E5=8F=82nullptr=E4=B8=BAundefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 顾冬洋 --- interfaces/kits/js/src/common/ani_helper/type_converter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 662006f95..cbafc941e 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++) { -- Gitee