Bug in trim prevented parsing gmail dump mbox format

This commit is contained in:
Jean-Francois Dockes 2019-10-07 10:56:18 +02:00
parent 5d8a66884a
commit 33f7d609dc

View File

@ -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());
}
}