From b4b208bb64326f989ee132504fabc5e4881e7001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 12 Jul 2020 15:49:07 +0200 Subject: [PATCH] src: refactor CertCbDone to avoid goto statement --- src/node_crypto.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index eae0f2e49d3c86..ebcf964637ed0c 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2496,10 +2496,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); @@ -2512,14 +2508,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;