mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +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
Notes:
sideshowbarker
2024-07-18 10:08:23 +09:00
Author: https://github.com/davidot
Commit: ae8c4618b7
Pull-request: https://github.com/SerenityOS/serenity/pull/8524
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg ✅
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)) {
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue