Skip to content

Commit

Permalink
contextify: use CHECK instead of if
Browse files Browse the repository at this point in the history
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: #3125
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
obastemur authored and rvagg committed Oct 2, 2015
1 parent 4c59407 commit e561585
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ class ContextifyContext {
object_template->SetHandler(config);

Local<Context> 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);

Expand Down

0 comments on commit e561585

Please sign in to comment.