summaryrefslogtreecommitdiff
path: root/src/string.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.cc')
-rw-r--r--src/string.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/string.cc b/src/string.cc
index 5a229030..18ae5d80 100644
--- a/src/string.cc
+++ b/src/string.cc
@@ -34,7 +34,7 @@ String::Data::Data(Data&& other) noexcept
if (other.is_long())
{
l = other.l;
- other.s.size = 1;
+ other.set_empty();
}
else
s = other.s;
@@ -52,6 +52,8 @@ String::Data& String::Data::operator=(const Data& other)
String::Data& String::Data::operator=(Data&& other) noexcept
{
+ release();
+
if (other.is_long())
{
l = other.l;