1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

Everywhere: Use OOM-safe ByteBuffer APIs where possible

If we can easily communicate failure, let's avoid asserting and report
failure instead.
This commit is contained in:
Ali Mohammad Pur 2021-09-06 03:28:46 +04:30 committed by Andreas Kling
parent 6606993432
commit 3a9f00c59b
Notes: sideshowbarker 2024-07-18 04:39:44 +09:00
22 changed files with 135 additions and 67 deletions

View file

@ -370,7 +370,8 @@ void Editor::insert(const u32 cp)
StringBuilder builder;
builder.append(Utf32View(&cp, 1));
auto str = builder.build();
m_pending_chars.append(str.characters(), str.length());
if (!m_pending_chars.try_append(str.characters(), str.length()))
return;
readjust_anchored_styles(m_cursor, ModificationKind::Insertion);