diff --git a/src/node_crypto.cc b/src/node_crypto.cc index c1a87de70986b6..7967d6a40be191 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3312,10 +3312,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,