From 33f7d609dc5b5851d03e370246f98f9a98ca21eb Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 7 Oct 2019 10:56:18 +0200 Subject: [PATCH] Bug in trim prevented parsing gmail dump mbox format --- src/utils/smallut.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()); } }