diff --git a/src/node_crypto.cc b/src/node_crypto.cc index dfc21ae6876105..60462cc114e6ef 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2495,10 +2495,6 @@ void SSLWrap::CertCbDone(const FunctionCallbackInfo& args) { env->sni_context_string()).ToLocalChecked(); Local cons = env->secure_context_constructor_template(); - // Not an object, probably undefined or null - if (!ctx->IsObject()) - goto fire_cb; - if (cons->HasInstance(ctx)) { SecureContext* sc = Unwrap(ctx.As()); CHECK_NOT_NULL(sc); @@ -2511,14 +2507,13 @@ void SSLWrap::CertCbDone(const FunctionCallbackInfo& args) { unsigned long err = ERR_get_error(); // NOLINT(runtime/int) return ThrowCryptoError(env, err, "CertCbDone"); } - } else { + } else if (ctx->IsObject()) { // Failure: incorrect SNI context object Local err = Exception::TypeError(env->sni_context_err_string()); w->MakeCallback(env->onerror_string(), 1, &err); return; } - fire_cb: CertCb cb; void* arg;