Skip to content

Commit aef41e5

Browse files
tniessenMylesBorins
authored andcommitted
src: refactor CertCbDone to avoid goto statement
PR-URL: #34325 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 1083073 commit aef41e5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/node_crypto.cc

+1-6
Original file line numberDiff line numberDiff line change
@@ -2495,10 +2495,6 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
24952495
env->sni_context_string()).ToLocalChecked();
24962496
Local<FunctionTemplate> cons = env->secure_context_constructor_template();
24972497

2498-
// Not an object, probably undefined or null
2499-
if (!ctx->IsObject())
2500-
goto fire_cb;
2501-
25022498
if (cons->HasInstance(ctx)) {
25032499
SecureContext* sc = Unwrap<SecureContext>(ctx.As<Object>());
25042500
CHECK_NOT_NULL(sc);
@@ -2511,14 +2507,13 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) {
25112507
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
25122508
return ThrowCryptoError(env, err, "CertCbDone");
25132509
}
2514-
} else {
2510+
} else if (ctx->IsObject()) {
25152511
// Failure: incorrect SNI context object
25162512
Local<Value> err = Exception::TypeError(env->sni_context_err_string());
25172513
w->MakeCallback(env->onerror_string(), 1, &err);
25182514
return;
25192515
}
25202516

2521-
fire_cb:
25222517
CertCb cb;
25232518
void* arg;
25242519

0 commit comments

Comments
 (0)