diff options
-rw-r--r-- | lib/System/Win32/Path.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 2dbf13e..7e22751 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -68,7 +68,12 @@ Path::operator=(StringRef that) { struct ScopedNullTerminator { std::string &str; ScopedNullTerminator(std::string &s) : str(s) { str.push_back(0); } - ~ScopedNullTerminator() { str.pop_back(); } + ~ScopedNullTerminator() { + // str.pop_back(); But wait, C++03 doesn't have this... + assert(!str.empty() && str[str.size() - 1] == 0 + && "Null char not present!"); + str.resize(str.size() - 1); + } }; bool |