Core/String: Fix error when using COW on empty string
Former-commit-id: 5d4bb54e4d7b9f68ef66ff8f099d9ea854d982b5 [formerly 8c7e15a2f6f5c1978a3e7b2c33f0ce038ca19dc7] [formerly 9b01d29473ca9d3d64333dd1aa79539a3b2dedb2 [formerly 9159fc04b30b7aef18d16ed1887ba637256a8ad8]] Former-commit-id: dcbc45c4fce819a44a47a02439a68276fae5b992 [formerly effba4f1df384c6bc7b87066fe94a93058302b0a] Former-commit-id: 357ad9fa46d773d6066b1b7cc945da663fe004f7
This commit is contained in:
parent
bbf9a5337d
commit
a7b98c407a
|
|
@ -4553,7 +4553,7 @@ namespace Nz
|
|||
|
||||
String& String::operator=(String&& string) noexcept
|
||||
{
|
||||
return Set(string);
|
||||
return Set(std::move(string));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -5852,7 +5852,7 @@ namespace Nz
|
|||
if (!m_sharedString.unique())
|
||||
{
|
||||
auto newSharedString = std::make_shared<SharedString>(GetSize(), GetCapacity());
|
||||
if (!discardContent)
|
||||
if (!discardContent && newSharedString->size > 0)
|
||||
std::memcpy(newSharedString->string.get(), GetConstBuffer(), GetSize()+1);
|
||||
|
||||
m_sharedString = std::move(newSharedString);
|
||||
|
|
|
|||
Loading…
Reference in New Issue