diff --git a/src/escape_string.cpp b/src/escape_string.cpp index 766afba6b..aa6fcaa5e 100644 --- a/src/escape_string.cpp +++ b/src/escape_string.cpp @@ -603,7 +603,7 @@ namespace libtorrent ws.resize(s.size() + 1); std::size_t size = MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, &ws[0], ws.size()); if (size == std::size_t(-1)) return s; - if (size != 0 && ret[size - 1] == '\0') --size; + if (size != 0 && ws[size - 1] == '\0') --size; ws.resize(size); std::string ret; libtorrent::wchar_utf8(ws, ret);