Skip to content

Commit 6df1132

Browse files
addaleaxtargos
authored andcommitted
src: guard against env != null in node_errors.cc
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>
1 parent 681d2a7 commit 6df1132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_errors.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static std::string GetErrorSource(Isolate* isolate,
6262
Environment* env = Environment::GetCurrent(isolate);
6363
const bool has_source_map_url =
6464
!message->GetScriptOrigin().SourceMapUrl().IsEmpty();
65-
if (has_source_map_url && env->source_maps_enabled()) {
65+
if (has_source_map_url && env != nullptr && env->source_maps_enabled()) {
6666
return sourceline;
6767
}
6868

0 commit comments

Comments
 (0)