aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/str.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 75394fcf89..0d24f2edac 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -264,6 +264,9 @@ String& String::operator =(char c) {
}
String &String::operator +=(const char *str) {
+ if (_str <= str && str <= _str + _size)
+ return operator+=(Common::String(str));
+
int len = strlen(str);
if (len > 0) {
ensureCapacity(_size + len, true);
@@ -275,6 +278,9 @@ String &String::operator +=(const char *str) {
}
String &String::operator +=(const String &str) {
+ if (&str == this)
+ return operator+=(Common::String(str));
+
int len = str._size;
if (len > 0) {
ensureCapacity(_size + len, true);