From f3a7f815684aba15ff0c03660eb293f158c4f5dd Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 6 Dec 2020 16:39:20 +0100 Subject: [PATCH] src: guard against env != null in node_errors.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise `TriggerUncaughtException()` → `PrintException()` → `GetErrorSource()` can crash. --- src/node_errors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_errors.cc b/src/node_errors.cc index dc6d20b500c655..5099ac03ddf7d6 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -63,7 +63,7 @@ static std::string GetErrorSource(Isolate* isolate, Environment* env = Environment::GetCurrent(isolate); const bool has_source_map_url = !message->GetScriptOrigin().SourceMapUrl().IsEmpty(); - if (has_source_map_url && env->source_maps_enabled()) { + if (has_source_map_url && env != nullptr && env->source_maps_enabled()) { return sourceline; }