Skip to content

Commit

Permalink
src: move CHECK in AddIsolateFinishedCallback
Browse files Browse the repository at this point in the history
`CHECK(it->second)` asserts that we have `PerIsolatePlatformData`
in the `per_isolate_` map, and not just a key with empty value. When
`it == per_isolate_.end()`, however, it means that we don't have the
isolate and the `CHECK(it->second)` is guaranteed to fail then!

PR-URL: #38010
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
indutny authored and guybedford committed Jul 26, 2021
1 parent 4a85a4b commit 32ff10c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_platform.cc
Expand Up @@ -359,10 +359,10 @@ void NodePlatform::AddIsolateFinishedCallback(Isolate* isolate,
Mutex::ScopedLock lock(per_isolate_mutex_);
auto it = per_isolate_.find(isolate);
if (it == per_isolate_.end()) {
CHECK(it->second);
cb(data);
return;
}
CHECK(it->second);
it->second->AddShutdownCallback(cb, data);
}

Expand Down

0 comments on commit 32ff10c

Please sign in to comment.