src: remove unnecessary ToLocalChecked call
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
e51267bd4d
commit
eb14b10370
@ -496,18 +496,19 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
|
|||||||
size_t length = end - start;
|
size_t length = end - start;
|
||||||
|
|
||||||
Local<Value> error;
|
Local<Value> error;
|
||||||
MaybeLocal<Value> ret =
|
MaybeLocal<Value> maybe_ret =
|
||||||
StringBytes::Encode(isolate,
|
StringBytes::Encode(isolate,
|
||||||
buffer.data() + start,
|
buffer.data() + start,
|
||||||
length,
|
length,
|
||||||
encoding,
|
encoding,
|
||||||
&error);
|
&error);
|
||||||
if (ret.IsEmpty()) {
|
Local<Value> ret;
|
||||||
|
if (!maybe_ret.ToLocal(&ret)) {
|
||||||
CHECK(!error.IsEmpty());
|
CHECK(!error.IsEmpty());
|
||||||
isolate->ThrowException(error);
|
isolate->ThrowException(error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args.GetReturnValue().Set(ret.ToLocalChecked());
|
args.GetReturnValue().Set(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user