Skip to content

Commit

Permalink
src: remove unnecessary ToLocalChecked call
Browse files Browse the repository at this point in the history
PR-URL: #36523
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
danbev authored and targos committed May 1, 2021
1 parent 9b13ddc commit e8f8c70
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,19 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
size_t length = end - start;

Local<Value> error;
MaybeLocal<Value> ret =
MaybeLocal<Value> maybe_ret =
StringBytes::Encode(isolate,
buffer.data() + start,
length,
encoding,
&error);
if (ret.IsEmpty()) {
Local<Value> ret;
if (!maybe_ret.ToLocal(&ret)) {
CHECK(!error.IsEmpty());
isolate->ThrowException(error);
return;
}
args.GetReturnValue().Set(ret.ToLocalChecked());
args.GetReturnValue().Set(ret);
}


Expand Down

0 comments on commit e8f8c70

Please sign in to comment.