소스 검색

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.
Linus Groh 5 년 전
부모
커밋
daf74838dd
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      Libraries/LibJS/Runtime/ArrayPrototype.cpp

+ 2 - 0
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;