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.

PR-URL: #36414
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
addaleax authored and nodejs-github-bot committed Dec 13, 2020
1 parent 88dfecc commit 7069d22
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 7069d22

Please sign in to comment.