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.
This commit is contained in:
Linus Groh 2020-05-22 23:17:10 +01:00 committed by Andreas Kling
parent 843e000f18
commit daf74838dd
Notes: sideshowbarker 2024-07-19 06:14:33 +09:00

View File

@ -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;