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!
  • Loading branch information
indutny committed Mar 31, 2021
1 parent 7d488fe commit ad7f207
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_platform.cc
Original file line number Diff line number Diff line change
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 ad7f207

Please sign in to comment.