mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +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:
parent
4846c4a94e
commit
ae8c4618b7
1 changed files with 2 additions and 2 deletions
|
@ -1845,10 +1845,10 @@ static size_t flatten_into_array(GlobalObject& global_object, Object& new_array,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth > 0 && value.is_array(global_object)) {
|
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())
|
if (vm.exception())
|
||||||
return {};
|
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())
|
if (vm.exception())
|
||||||
return {};
|
return {};
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue