Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e561585

Browse filesBrowse 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 <info@bnoordhuis.nl>
1 parent 4c59407 commit e561585
Copy full SHA for e561585

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎src/node_contextify.cc‎

Copy file name to clipboardExpand all lines: src/node_contextify.cc
+3-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.