summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-22 23:17:10 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-23 00:38:00 +0200
commitdaf74838ddae1d92c19a17fa7593e118cdcb14d3 (patch)
treeef94faab75ca00219c3fbbd71c272a1f836c7476 /Libraries/LibJS/Runtime
parent843e000f1870033d5043cd58b77d8358f5da9cb6 (diff)
downloadserenity-daf74838ddae1d92c19a17fa7593e118cdcb14d3.zip
LibJS: Add missing exception check to ArrayPrototype's for_each_item()
Object::get_by_index() cannot throw for positive indices *right now*, but once we implement descriptors for array index properties, it can.
Diffstat (limited to 'Libraries/LibJS/Runtime')
-rw-r--r--Libraries/LibJS/Runtime/ArrayPrototype.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
index 983e4c36b6..99eff4869b 100644
--- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp
+++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp
@@ -111,6 +111,8 @@ static void for_each_item(Interpreter& interpreter, const String& name, AK::Func
for (size_t i = 0; i < initial_length; ++i) {
auto value = this_object->get_by_index(i);
+ if (interpreter.exception())
+ return;
if (value.is_empty()) {
if (skip_empty)
continue;