Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-12-06 18:39:20 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2020-12-13 17:28:21 +0300
commit7069d223431a527aa7355d91c55241799057ae87 (patch)
tree03a637db8af61f0b749682165c4affd4d880019b /src/node_errors.cc
parent88dfecc44b6887334819ded403082af80f9e5f5b (diff)
src: guard against env != null in node_errors.cc
Otherwise `TriggerUncaughtException()` → `PrintException()` → `GetErrorSource()` can crash. PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src/node_errors.cc')
-rw-r--r--src/node_errors.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_errors.cc b/src/node_errors.cc
index dc6d20b500c..5099ac03ddf 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -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;
}