From c492a2715e5e525cfd1ad7966f28c84887553c1e Mon Sep 17 00:00:00 2001 From: wenningplus Date: Thu, 18 Jun 2020 19:11:04 +0800 Subject: [PATCH] src: use ToLocal in node_os.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/33939 Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_os.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_os.cc b/src/node_os.cc index bd61b4c87c0e1a..085fb1aef01c32 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -268,10 +268,10 @@ static void GetUserInfo(const FunctionCallbackInfo& args) { Local options = args[0].As(); MaybeLocal maybe_encoding = options->Get(env->context(), env->encoding_string()); - if (maybe_encoding.IsEmpty()) - return; + Local encoding_opt; + if (!maybe_encoding.ToLocal(&encoding_opt)) + return; - Local encoding_opt = maybe_encoding.ToLocalChecked(); encoding = ParseEncoding(env->isolate(), encoding_opt, UTF8); } else { encoding = UTF8;