Skip to content

Commit

Permalink
src: guard against env != null in node_errors.cc
Browse files Browse the repository at this point in the history
Otherwise
`TriggerUncaughtException()`
β†’ `PrintException()`
β†’ `GetErrorSource()`
can crash.
  • Loading branch information
addaleax committed Dec 6, 2020
1 parent 20de5f7 commit f3a7f81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f3a7f81

Please sign in to comment.