diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 3dff06f671756c..c2faad0a5966bc 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3339,10 +3339,12 @@ Local KeyObject::Initialize(Environment* env, Local target) { GetAsymmetricKeyType); env->SetProtoMethod(t, "export", Export); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "KeyObject"), - t->GetFunction(env->context()).ToLocalChecked()); + auto function = t->GetFunction(env->context()).ToLocalChecked(); + target->Set(env->context(), + FIXED_ONE_BYTE_STRING(env->isolate(), "KeyObject"), + function).FromJust(); - return t->GetFunction(); + return function; } Local KeyObject::Create(Environment* env,