mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibJS: Convert to_length() to ThrowCompletionOr
This commit is contained in:
parent
750da61c0f
commit
aad12b050b
Notes:
sideshowbarker
2024-07-18 02:12:15 +09:00
Author: https://github.com/IdanHo
Commit: aad12b050b
Pull-request: https://github.com/SerenityOS/serenity/pull/10522
Reviewed-by: https://github.com/linusg ✅
8 changed files with 20 additions and 34 deletions
|
@ -425,9 +425,7 @@ JS_DEFINE_NATIVE_FUNCTION(WorkbookObject::sheet)
|
|||
return JS::Value(&sheet.global_object());
|
||||
}
|
||||
} else {
|
||||
auto index = name_value.to_length(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto index = TRY_OR_DISCARD(name_value.to_length(global_object));
|
||||
if (index < workbook.sheets().size())
|
||||
return JS::Value(&workbook.sheets()[index].global_object());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue