mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +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
|
@ -490,7 +490,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::escape)
|
|||
{
|
||||
auto string = TRY(vm.argument(0).to_string(vm));
|
||||
StringBuilder escaped;
|
||||
for (auto code_point : utf8_to_utf16(string)) {
|
||||
for (auto code_point : TRY_OR_THROW_OOM(vm, utf8_to_utf16(string))) {
|
||||
if (code_point < 256) {
|
||||
if ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"sv.contains(static_cast<char>(code_point)))
|
||||
escaped.append(code_point);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue