diff --git a/interfaces/kits/js/src/mod_fileio/properties/fchmod.cpp b/interfaces/kits/js/src/mod_fileio/properties/fchmod.cpp index c1aca5c124ec2676ddcbf6a66c58c5be681f1237..8715b994ce2d1a814db4a60f48d5903519df5513 100644 --- a/interfaces/kits/js/src/mod_fileio/properties/fchmod.cpp +++ b/interfaces/kits/js/src/mod_fileio/properties/fchmod.cpp @@ -75,6 +75,7 @@ napi_value Fchmod::Async(napi_env env, napi_callback_info info) auto [resGetSecondArg, mode] = NVal(env, funcArg[NARG_POS::SECOND]).ToInt32(); if (!resGetSecondArg) { UniError(EINVAL).ThrowErr(env, "Invalid owner"); + return nullptr; } auto cbExec = [fd = fd, mode = mode](napi_env env) -> UniError { diff --git a/interfaces/kits/js/src/mod_fileio/properties/fchown.cpp b/interfaces/kits/js/src/mod_fileio/properties/fchown.cpp index 1af80004f68ac1910f1e50c86094fec26f389fe6..073269629a6fc567ac8a2e064cda392a76877171 100644 --- a/interfaces/kits/js/src/mod_fileio/properties/fchown.cpp +++ b/interfaces/kits/js/src/mod_fileio/properties/fchown.cpp @@ -44,11 +44,13 @@ napi_value Fchown::Sync(napi_env env, napi_callback_info info) auto [resGetSecondArg, owner] = NVal(env, funcArg[NARG_POS::SECOND]).ToInt32(); if (!resGetSecondArg) { UniError(EINVAL).ThrowErr(env, "Invalid owner"); + return nullptr; } auto [resGetThirdArg, group] = NVal(env, funcArg[NARG_POS::THIRD]).ToInt32(); if (!resGetThirdArg) { UniError(EINVAL).ThrowErr(env, "Invalid group"); + return nullptr; } int ret = fchown(fd, owner, group); @@ -77,11 +79,13 @@ napi_value Fchown::Async(napi_env env, napi_callback_info info) auto [resGetSecondArg, owner] = NVal(env, funcArg[NARG_POS::SECOND]).ToInt32(); if (!resGetSecondArg) { UniError(EINVAL).ThrowErr(env, "Invalid owner"); + return nullptr; } auto [resGetThirdArg, group] = NVal(env, funcArg[NARG_POS::THIRD]).ToInt32(); if (!resGetThirdArg) { UniError(EINVAL).ThrowErr(env, "Invalid group"); + return nullptr; } auto cbExec = [fd = fd, owner = owner, group = group](napi_env env) -> UniError { diff --git a/interfaces/kits/js/src/mod_fileio/properties/prop_n_exporter.cpp b/interfaces/kits/js/src/mod_fileio/properties/prop_n_exporter.cpp index 0a08765bf6b29bca255cacad6a01c93404689831..e7fbbb12e2c9ff8cf709dcfa92e1932c3fd2648c 100644 --- a/interfaces/kits/js/src/mod_fileio/properties/prop_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fileio/properties/prop_n_exporter.cpp @@ -377,12 +377,14 @@ napi_value PropNExporter::FchownSync(napi_env env, napi_callback_info info) tie(succ, owner) = NVal(env, funcArg[NARG_POS::SECOND]).ToInt32(); if (!succ) { UniError(EINVAL).ThrowErr(env, "Invalid owner"); + return nullptr; } int group; tie(succ, group) = NVal(env, funcArg[NARG_POS::THIRD]).ToInt32(); if (!succ) { UniError(EINVAL).ThrowErr(env, "Invalid group"); + return nullptr; } int ret = fchown(fd, owner, group);