mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
LibJS: Handle OOM errors in String.prototype.replaceAll
This commit is contained in:
parent
57b918807e
commit
48474b0de6
1 changed files with 1 additions and 1 deletions
|
@ -663,7 +663,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::replace_all)
|
||||||
auto position = string_index_of(string.view(), search_string.view(), 0);
|
auto position = string_index_of(string.view(), search_string.view(), 0);
|
||||||
|
|
||||||
while (position.has_value()) {
|
while (position.has_value()) {
|
||||||
match_positions.append(*position);
|
TRY_OR_THROW_OOM(vm, match_positions.try_append(*position));
|
||||||
position = string_index_of(string.view(), search_string.view(), *position + advance_by);
|
position = string_index_of(string.view(), search_string.view(), *position + advance_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue