Skip to content

Commit 308f762

Browse files
author
Felix The Cat
committed
src: add CHECK_NOT_NULL for eq_wrap_async
1 parent 43258fd commit 308f762

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

src/node_file.cc

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,25 +1992,24 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
19921992

19931993
if (argc > 3) { // readdir(path, encoding, withTypes, req)
19941994
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
1995-
if (req_wrap_async != nullptr) {
1996-
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
1997-
env,
1998-
req_wrap_async,
1999-
permission::PermissionScope::kFileSystemRead,
2000-
path.ToStringView());
2001-
req_wrap_async->set_with_file_types(with_types);
2002-
FS_ASYNC_TRACE_BEGIN1(
2003-
UV_FS_SCANDIR, req_wrap_async, "path", TRACE_STR_COPY(*path))
2004-
AsyncCall(env,
2005-
req_wrap_async,
2006-
args,
2007-
"scandir",
2008-
encoding,
2009-
AfterScanDir,
2010-
uv_fs_scandir,
2011-
*path,
2012-
0 /*flags*/);
2013-
}
1995+
CHECK_NOT_NULL(req_wrap_async);
1996+
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
1997+
env,
1998+
req_wrap_async,
1999+
permission::PermissionScope::kFileSystemRead,
2000+
path.ToStringView());
2001+
req_wrap_async->set_with_file_types(with_types);
2002+
FS_ASYNC_TRACE_BEGIN1(
2003+
UV_FS_SCANDIR, req_wrap_async, "path", TRACE_STR_COPY(*path))
2004+
AsyncCall(env,
2005+
req_wrap_async,
2006+
args,
2007+
"scandir",
2008+
encoding,
2009+
AfterScanDir,
2010+
uv_fs_scandir,
2011+
*path,
2012+
0 /*flags*/);
20142013
} else { // readdir(path, encoding, withTypes)
20152014
THROW_IF_INSUFFICIENT_PERMISSIONS(
20162015
env, permission::PermissionScope::kFileSystemRead, path.ToStringView());

0 commit comments

Comments
 (0)