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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Shelley Vohr <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
addaleax authored and targos committed May 1, 2021
1 parent 681d2a7 commit 6df1132
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 @@ -62,7 +62,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 6df1132

Please sign in to comment.