Skip to content

Commit 34c870e

Browse files
danbevBethGriggs
authored andcommittedDec 15, 2020
src: use MaybeLocal.ToLocal instead of IsEmpty
PR-URL: #35716 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 47b4b2b commit 34c870e

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
@@ -423,12 +423,13 @@ MaybeLocal<Object> New(Environment* env,
423423
True(env->isolate())).IsNothing()) {
424424
return Local<Object>();
425425
}
426-
MaybeLocal<Uint8Array> ui = Buffer::New(env, ab, 0, length);
426+
MaybeLocal<Uint8Array> maybe_ui = Buffer::New(env, ab, 0, length);
427427

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

431-
return scope.Escape(ui.ToLocalChecked());
432+
return scope.Escape(ui);
432433
}
433434

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

0 commit comments

Comments
 (0)
Please sign in to comment.