diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 21c78173329a8b..77efa7bae2fea5 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -496,18 +496,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); }