Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: use MaybeLocal.ToLocal instead of IsEmpty
  • Loading branch information
danbev committed Oct 20, 2020
commit f2016affa1d6a63d644f125802b0bfd1c1c20dfa
7 changes: 4 additions & 3 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,13 @@ MaybeLocal<Object> New(Environment* env,
True(env->isolate())).IsNothing()) {
return Local<Object>();
}
MaybeLocal<Uint8Array> ui = Buffer::New(env, ab, 0, length);
MaybeLocal<Uint8Array> maybe_ui = Buffer::New(env, ab, 0, length);

if (ui.IsEmpty())
Local<Uint8Array> ui;
if (!maybe_ui.ToLocal(&ui))
return MaybeLocal<Object>();

return scope.Escape(ui.ToLocalChecked());
return scope.Escape(ui);
Comment thread
targos marked this conversation as resolved.
}

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