From d25eff2ff3b3ffc1fd4a02b3d895213180c42977 Mon Sep 17 00:00:00 2001 From: tianp Date: Mon, 4 Aug 2025 11:26:50 +0800 Subject: [PATCH] =?UTF-8?q?randomaccessfile=E7=B1=BBcreatewritestream?= =?UTF-8?q?=E5=87=BD=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: I24fdf35f98a084b01890a617462270881c72b5a9 --- .../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..0e1eebc96 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 @@ -332,11 +332,13 @@ static ani_object CreateWriteStreamOptions(ani_env *env, int64_t start, int flag 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); @@ -344,11 +346,12 @@ static ani_object CreateWriteStreamOptions(ani_env *env, int64_t start, int flag } ani_field modeField = nullptr; - ani_field startField = nullptr; if (ANI_OK != env->Class_FindField(cls, "mode", &modeField)) { HILOGE("Cannot find mode in class %s", className); return nullptr; } + + ani_field startField = nullptr; if (ANI_OK != env->Class_FindField(cls, "start", &startField)) { HILOGE("Cannot find start in class %s", className); return nullptr; -- Gitee