From 7efb3111e834407e0a24916c956e2d4c027e6458 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 15 Dec 2020 06:17:55 +0100 Subject: [PATCH] src: remove unnecessary ToLocalChecked call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/36523 Reviewed-By: Michaƫl Zasso Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/node_buffer.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); }