diff --git a/src/node_os.cc b/src/node_os.cc index 6d52c2e44d0aec..b6fbb126b2f7bc 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -273,10 +273,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;