Skip to content

Commit 4b8b5fe

Browse files
danbevtargos
authored andcommitted
src: use MaybeLocal.ToLocal instead of IsEmpty
PR-URL: #35716 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 01d7c46 commit 4b8b5fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/node_buffer.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,13 @@ MaybeLocal<Object> New(Environment* env,
424424
True(env->isolate())).IsNothing()) {
425425
return Local<Object>();
426426
}
427-
MaybeLocal<Uint8Array> ui = Buffer::New(env, ab, 0, length);
427+
MaybeLocal<Uint8Array> maybe_ui = Buffer::New(env, ab, 0, length);
428428

429-
if (ui.IsEmpty())
429+
Local<Uint8Array> ui;
430+
if (!maybe_ui.ToLocal(&ui))
430431
return MaybeLocal<Object>();
431432

432-
return scope.Escape(ui.ToLocalChecked());
433+
return scope.Escape(ui);
433434
}
434435

435436
// Warning: This function needs `data` to be allocated with malloc() and not

0 commit comments

Comments
 (0)