diff options
Fixed String read not allocating memory
1 files changed, 2 insertions, 0 deletions
| -rw-r--r-- | src/Generic/String/String.cpp | 2 |
diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp index 66e9ad4..9d61999 100644 --- a/src/Generic/String/String.cpp +++ b/src/Generic/String/String.cpp @@ -121,6 +121,8 @@ String& String::operator=(String&& other) { */ void String::read(std::istream& istr) { istr.read((char*)&length, sizeof(length)); + delete[] str; + str = new char[length + 1]; istr.read(str, sizeof(char) * (length + 1)); } |
