diff --git a/Char.cpp b/Char.cpp index ec18d74..7718b12 100644 --- a/Char.cpp +++ b/Char.cpp @@ -8,7 +8,7 @@ Char::operator char() const Char& Char::operator=(char other) { - auto data = new char[_string.size() + 2]; // space for new char & null-terminator + auto data = new char[_string.size() + 1]; // space for old string & null-terminator std::strcpy(data, _string.c_str()); data[_index] = other; // set the desired char @@ -17,4 +17,4 @@ Char& Char::operator=(char other) _string._str = new StringValue(data); // make a new one return *this; -} \ No newline at end of file +}