From 11a8a940d7bf03dc108082bdd456668210b949c1 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 18 Feb 2019 13:19:57 -0500 Subject: [PATCH] report: simplify OnFatalError() handling PR-URL: https://github.com/nodejs/node/pull/26191 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- src/node_errors.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/node_errors.cc b/src/node_errors.cc index 39673abf7f0e41..a17012b5b373fe 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -316,15 +316,9 @@ void OnFatalError(const char* location, const char* message) { Isolate* isolate = Isolate::GetCurrent(); HandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); - if (env != nullptr) { - std::shared_ptr options = env->isolate_data()->options(); - if (options->report_on_fatalerror) { - report::TriggerNodeReport( - isolate, env, message, __func__, "", Local()); - } - } else { + if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( - isolate, nullptr, message, __func__, "", Local()); + isolate, env, message, __func__, "", Local()); } #endif // NODE_REPORT fflush(stderr);