mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 08:18:55 +00:00
AK+Everywhere: Make UTF-8 and UTF-32 to UTF-16 converters fallible
These could fail to allocate the underlying storage needed to store the UTF-16 data. Propagate these errors.
This commit is contained in:
parent
d8044c5358
commit
1edb96376b
Notes:
sideshowbarker
2024-07-17 18:46:30 +09:00
Author: https://github.com/trflynn89
Commit: 1edb96376b
Pull-request: https://github.com/SerenityOS/serenity/pull/16895
Reviewed-by: https://github.com/linusg
13 changed files with 46 additions and 35 deletions
|
@ -142,8 +142,8 @@ public:
|
|||
return 0;
|
||||
}
|
||||
case UTF16: {
|
||||
auto utf16_view = Utf16View(utf8_to_utf16(m_values.at(index.row())));
|
||||
if (utf16_view.validate())
|
||||
auto utf16_data = utf8_to_utf16(m_values.at(index.row())).release_value_but_fixme_should_propagate_errors();
|
||||
if (Utf16View utf16_view { utf16_data }; utf16_view.validate())
|
||||
return static_cast<i32>(utf16_view.length_in_code_units() * 2);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue