From a83fd3ef19e0ddb69699237c922d9fe01745b259 Mon Sep 17 00:00:00 2001 From: tianp Date: Mon, 4 Aug 2025 14:51:27 +0800 Subject: [PATCH] =?UTF-8?q?random=E7=B1=BBcreatereadstream=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tianp Change-Id: I06bee9053467fd238bf077cb2eb0548e6a7d546b --- .../class_randomaccessfile/ani/randomaccessfile_ani.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp index f3172480b..d79928731 100644 --- a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp +++ b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/ani/randomaccessfile_ani.cpp @@ -289,11 +289,13 @@ static ani_object CreateReadStreamOptions(ani_env *env, int64_t start, int64_t e HILOGE("Cannot find class %s", className); return nullptr; } + ani_method ctor; if (ANI_OK != env->Class_FindMethod(cls, "", ":V", &ctor)) { HILOGE("Cannot find constructor method for class %s", className); return nullptr; } + ani_object obj; if (ANI_OK != env->Object_New(cls, ctor, &obj)) { HILOGE("New %s obj Failed", className); @@ -301,11 +303,12 @@ static ani_object CreateReadStreamOptions(ani_env *env, int64_t start, int64_t e } ani_field startField = nullptr; - ani_field endField = nullptr; if (ANI_OK != env->Class_FindField(cls, "start", &startField)) { HILOGE("Cannot find start in class %s", className); return nullptr; } + + ani_field endField = nullptr; if (ANI_OK != env->Class_FindField(cls, "end", &endField)) { HILOGE("Cannot find end in class %s", className); return nullptr; -- Gitee