diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 217854255d2806..3a943cc6369deb 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -495,18 +495,19 @@ void StringSlice(const FunctionCallbackInfo& args) { size_t length = end - start; Local error; - MaybeLocal ret = + MaybeLocal maybe_ret = StringBytes::Encode(isolate, buffer.data() + start, length, encoding, &error); - if (ret.IsEmpty()) { + Local ret; + if (!maybe_ret.ToLocal(&ret)) { CHECK(!error.IsEmpty()); isolate->ThrowException(error); return; } - args.GetReturnValue().Set(ret.ToLocalChecked()); + args.GetReturnValue().Set(ret); }