From e5615854ea81a18e3aca7b03b52b9f6d73657d84 Mon Sep 17 00:00:00 2001 From: Oguz Bastemur Date: Wed, 30 Sep 2015 07:02:12 +0200 Subject: [PATCH] contextify: use CHECK instead of `if` I was walking through the vm changes and saw this particular `if` check interesting. In case `ctx` is empty it's going to fail later anyways. So, instead of putting an `if` check there; option a - use CHECK option b - do nothing Considering the developer wanted to make sure `ctx` is not empty, `CHECK` option looked more convenient. PR-URL: https://github.com/nodejs/node/pull/3125 Reviewed-By: Ben Noordhuis --- src/node_contextify.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 6520355239ea84..8880439c8a7e3f 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -216,8 +216,9 @@ class ContextifyContext { object_template->SetHandler(config); Local ctx = Context::New(env->isolate(), nullptr, object_template); - if (!ctx.IsEmpty()) - ctx->SetSecurityToken(env->context()->GetSecurityToken()); + + CHECK(!ctx.IsEmpty()); + ctx->SetSecurityToken(env->context()->GetSecurityToken()); env->AssignToContext(ctx);