src: fix fatal errors when a current isolate not exist

napi_fatal_error and node watchdog trigger fatal error but rather
running on a thread that hold no current isolate.

PR-URL: https://github.com/nodejs/node/pull/38624
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
legendecas authored and Michaël Zasso committed 2021-05-18 13:10:10 +02:00
1 parent a0dc194e31
commit 718ad105e5
5 files changed
+49

No files matched your search

+6
View File
@@ -425,6 +425,12 @@ void OnFatalError(const char* location, const char* message) {
}
Isolate* isolate = Isolate::GetCurrent();
// TODO(legendecas): investigate failures on triggering node-report with
// nullptr isolates.
if (isolate == nullptr) {
fflush(stderr);
ABORT();
}
Environment* env = Environment::GetCurrent(isolate);
bool report_on_fatalerror;
{