diff options
author | Paul Redmond <paul.redmond@gmail.com> | 2020-04-08 11:04:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 17:04:37 +0200 |
commit | a9779e12ea6bbe9015b668c5ee1ac0514da8a505 (patch) | |
tree | 4bba1fdedb85929b9fea47b8866e5a0b80441176 /AK/ByteBuffer.h | |
parent | 38dfd046332fd0b72930181bc220b3ca8a69ee46 (diff) | |
download | serenity-a9779e12ea6bbe9015b668c5ee1ac0514da8a505.zip |
AK: Appending 0 bytes to a ByteBuffer should be a no-op (#1699)
- inserting an empty string into LibLine Editor triggered an assertion
trying to grow a ByteBuffer by 0 bytes.
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r-- | AK/ByteBuffer.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index 3f8a245fdd..af5f98823d 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -211,6 +211,9 @@ public: void append(const void* data, size_t data_size) { + if (data_size == 0) + return; + ASSERT(data != nullptr); int old_size = size(); grow(size() + data_size); __builtin_memcpy(this->data() + old_size, data, data_size); |