Skip to content

Commit f552c45

Browse files
indutnyrichardlau
authored andcommitted
src: move CHECK in AddIsolateFinishedCallback
`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>
1 parent 30ce0e6 commit f552c45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_platform.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@ void NodePlatform::AddIsolateFinishedCallback(Isolate* isolate,
359359
Mutex::ScopedLock lock(per_isolate_mutex_);
360360
auto it = per_isolate_.find(isolate);
361361
if (it == per_isolate_.end()) {
362-
CHECK(it->second);
363362
cb(data);
364363
return;
365364
}
365+
CHECK(it->second);
366366
it->second->AddShutdownCallback(cb, data);
367367
}
368368

0 commit comments

Comments
 (0)