1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:07:36 +00:00

LibJS: Use as_object instead of as_array in flatten_into_array

Since is_array does not guarantee that it is<Array> we must use
as_object here.
This commit is contained in:
davidot 2021-07-07 14:21:57 +02:00 committed by Linus Groh
parent 4846c4a94e
commit ae8c4618b7

View file

@ -1845,10 +1845,10 @@ static size_t flatten_into_array(GlobalObject& global_object, Object& new_array,
}
if (depth > 0 && value.is_array(global_object)) {
auto length = length_of_array_like(global_object, value.as_array());
auto length = length_of_array_like(global_object, value.as_object());
if (vm.exception())
return {};
target_index = flatten_into_array(global_object, new_array, value.as_array(), length, target_index, depth - 1);
target_index = flatten_into_array(global_object, new_array, value.as_object(), length, target_index, depth - 1);
if (vm.exception())
return {};
continue;