Skip to content

Commit 96c095f

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 56fe9ba commit 96c095f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_errors.cc

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

0 commit comments

Comments
 (0)