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;