summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-04-25 21:45:23 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-25 21:45:23 +0200
commitaf62678c3112aaee45b1bfeeeacf5386b33e4e46 (patch)
tree141aabcc2d59717aa382f4e43adf8441bee780b9 /Userland
parentdbe72fd9627f701210d69c9b01db762b2c950190 (diff)
downloadserenity-af62678c3112aaee45b1bfeeeacf5386b33e4e46.zip
LibJS: Don't assume call_frame->current_node in Exception constructor
It's a nullptr in promise reaction job functions, for example. Regressed in 97d49cb. Fixes #6641.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Exception.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Exception.cpp b/Userland/Libraries/LibJS/Runtime/Exception.cpp
index 9043be5869..fa59a07e54 100644
--- a/Userland/Libraries/LibJS/Runtime/Exception.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Exception.cpp
@@ -24,7 +24,11 @@ Exception::Exception(Value value)
function_name = "<anonymous>";
m_traceback.prepend({
.function_name = move(function_name),
- .source_range = call_frame->current_node->source_range(),
+ // We might not have an AST node associated with the call frame, e.g. in promise
+ // reaction jobs (which aren't called anywhere from the source code).
+ // They're not going to generate any _unhandled_ exceptions though, so a meaningless
+ // source range is fine.
+ .source_range = call_frame->current_node ? call_frame->current_node->source_range() : SourceRange {},
});
}
}