mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibJS: Avoid crashing when the Unicode data generators are disabled
The general idea when ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF has been that the Intl APIs will provide obviously incorrect results, but should not crash. This regressed a bit with NumberFormat and DateTimeFormat.
This commit is contained in:
parent
48dc28996d
commit
9ce4ff4265
Notes:
sideshowbarker
2024-07-17 22:22:09 +09:00
Author: https://github.com/trflynn89
Commit: 9ce4ff4265
Pull-request: https://github.com/SerenityOS/serenity/pull/11370
Reviewed-by: https://github.com/linusg ✅
2 changed files with 8 additions and 4 deletions
|
@ -135,13 +135,16 @@ ThrowCompletionOr<DateTimeFormat*> initialize_date_time_format(GlobalObject& glo
|
|||
|
||||
// 19. Let calendar be r.[[ca]].
|
||||
// 20. Set dateTimeFormat.[[Calendar]] to calendar.
|
||||
date_time_format.set_calendar(result.ca.release_value());
|
||||
if (result.ca.has_value())
|
||||
date_time_format.set_calendar(result.ca.release_value());
|
||||
|
||||
// 21. Set dateTimeFormat.[[HourCycle]] to r.[[hc]].
|
||||
date_time_format.set_hour_cycle(result.hc.release_value());
|
||||
if (result.hc.has_value())
|
||||
date_time_format.set_hour_cycle(result.hc.release_value());
|
||||
|
||||
// 22. Set dateTimeFormat.[[NumberingSystem]] to r.[[nu]].
|
||||
date_time_format.set_numbering_system(result.nu.release_value());
|
||||
if (result.nu.has_value())
|
||||
date_time_format.set_numbering_system(result.nu.release_value());
|
||||
|
||||
// 23. Let dataLocale be r.[[dataLocale]].
|
||||
auto data_locale = move(result.data_locale);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue