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 Dec 21, 2020
1 parent b6a31f0 commit 7efb311
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 @@ -496,18 +496,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 7efb311

Please sign in to comment.