Fixed String constructor (Close #24)
Former-commit-id: 4be4b713375ab4285776ec22b598117e3ede418a
This commit is contained in:
parent
b9dca8966d
commit
bcfe357be7
|
|
@ -121,7 +121,8 @@ NzString::NzString(const char* string, unsigned int length)
|
||||||
m_sharedString->capacity = length;
|
m_sharedString->capacity = length;
|
||||||
m_sharedString->size = length;
|
m_sharedString->size = length;
|
||||||
m_sharedString->string = new char[length+1];
|
m_sharedString->string = new char[length+1];
|
||||||
std::memcpy(m_sharedString->string, string, length+1);
|
std::memcpy(m_sharedString->string, string, length);
|
||||||
|
m_sharedString->string[length] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_sharedString = &emptyString;
|
m_sharedString = &emptyString;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue