Skip to content

Commit e561585

Browse files
obastemurrvagg
authored andcommitted
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: #3125 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 4c59407 commit e561585

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/node_contextify.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@ class ContextifyContext {
216216
object_template->SetHandler(config);
217217

218218
Local<Context> ctx = Context::New(env->isolate(), nullptr, object_template);
219-
if (!ctx.IsEmpty())
220-
ctx->SetSecurityToken(env->context()->GetSecurityToken());
219+
220+
CHECK(!ctx.IsEmpty());
221+
ctx->SetSecurityToken(env->context()->GetSecurityToken());
221222

222223
env->AssignToContext(ctx);
223224

0 commit comments

Comments
 (0)