diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index f58dbfc0..3a1905fb 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -491,7 +491,9 @@ void trimstring(string& s, const char *ws) void rtrimstring(string& s, const char *ws) { string::size_type pos = s.find_last_not_of(ws); - if (pos != string::npos && pos != s.length() - 1) { + if (pos == string::npos) { + s.clear(); + } else if (pos != s.length() - 1) { s.replace(pos + 1, string::npos, string()); } }