Skip to content

Commit 066ca98

Browse files
danbevcodebytere
authored andcommitted
src: use MaybeLocal.ToLocal instead of IsEmpty
This commit suggest using MaybeLocal.ToLocal and passing in the Local<Function> fn. The motivation for doing this is that the following MaybeLocal.ToLocalChecked call can then be avoided. PR-URL: #33312 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b41affb commit 066ca98

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ MaybeLocal<Value> ExecuteBootstrapper(Environment* env,
171171
MaybeLocal<Function> maybe_fn =
172172
NativeModuleEnv::LookupAndCompile(env->context(), id, parameters, env);
173173

174-
if (maybe_fn.IsEmpty()) {
174+
Local<Function> fn;
175+
if (!maybe_fn.ToLocal(&fn)) {
175176
return MaybeLocal<Value>();
176177
}
177178

178-
Local<Function> fn = maybe_fn.ToLocalChecked();
179179
MaybeLocal<Value> result = fn->Call(env->context(),
180180
Undefined(env->isolate()),
181181
arguments->size(),

0 commit comments

Comments
 (0)