summaryrefslogtreecommitdiff
path: root/AK/String.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-06-29 17:50:37 +0300
committerLinus Groh <mail@linusgroh.de>2021-06-29 16:55:54 +0100
commita76813172086995968a6bca9984e6ec508ae7bd1 (patch)
tree5ad5d44a583e398aee0f8975ac33bc2a38e245ab /AK/String.cpp
parent4a2a0847892ec4de2f2c5a82e42152c498b15956 (diff)
downloadserenity-a76813172086995968a6bca9984e6ec508ae7bd1.zip
AK: Ensure StringBuilder capacity in String::reverse
Diffstat (limited to 'AK/String.cpp')
-rw-r--r--AK/String.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/String.cpp b/AK/String.cpp
index 79d849496f..44fd77fb70 100644
--- a/AK/String.cpp
+++ b/AK/String.cpp
@@ -358,7 +358,7 @@ size_t String::count(const String& needle) const
String String::reverse() const
{
- StringBuilder reversed_string;
+ StringBuilder reversed_string(length());
for (size_t i = length(); i-- > 0;) {
reversed_string.append(characters()[i]);
}