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 <[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]>
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)