mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +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
13 changed files with 46 additions and 35 deletions
|
@ -123,7 +123,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point)
|
|||
if (code_point < 0 || code_point > 0x10FFFF)
|
||||
return vm.throw_completion<RangeError>(ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects());
|
||||
|
||||
AK::code_point_to_utf16(string, static_cast<u32>(code_point));
|
||||
TRY_OR_THROW_OOM(vm, code_point_to_utf16(string, static_cast<u32>(code_point)));
|
||||
}
|
||||
|
||||
return PrimitiveString::create(vm, Utf16String(move(string)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue