diff --git a/src/node_crypto.cc b/src/node_crypto.cc index a9d52a98ec238c..b954397dae2e2e 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2474,10 +2474,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); @@ -2490,14 +2486,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;