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 f3172480b2edfa9d653c5a66567cb72dce19e362..d799287319c4040378ffa10cebdc3ccc8b8620fc 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;