summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2017-11-15 12:44:19 +0100
committerLubos Dolezel <lubos@dolezel.info>2017-11-15 12:44:19 +0100
commitff62a107f10fa586e25a46aef4fe06dea18b6c10 (patch)
tree807735a5ff45617016512e94a951552c8a50e23f
parent87dc2e6e15e76885b2e8e06dfa9af4b0dbb751f5 (diff)
downloadtwinkle-ff62a107f10fa586e25a46aef4fe06dea18b6c10.tar
twinkle-ff62a107f10fa586e25a46aef4fe06dea18b6c10.tar.gz
twinkle-ff62a107f10fa586e25a46aef4fe06dea18b6c10.tar.lz
twinkle-ff62a107f10fa586e25a46aef4fe06dea18b6c10.tar.xz
twinkle-ff62a107f10fa586e25a46aef4fe06dea18b6c10.zip
Fix crash in parsing pending message count
-rw-r--r--src/mwi/simple_msg_sum_body.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mwi/simple_msg_sum_body.cpp b/src/mwi/simple_msg_sum_body.cpp
index b42be6a..34aeede 100644
--- a/src/mwi/simple_msg_sum_body.cpp
+++ b/src/mwi/simple_msg_sum_body.cpp
@@ -54,8 +54,12 @@ bool t_msg_summary::parse(const string &s) {
} else if (m.size() == 5) {
newmsgs = std::stoul(m.str(1), NULL, 10);
oldmsgs = std::stoul(m.str(2), NULL, 10);
- newmsgs_urgent = std::stoul(m.str(3), NULL, 10);
- oldmsgs_urgent = std::stoul(m.str(4), NULL, 10);
+
+ if (!m.str(3).empty())
+ newmsgs_urgent = std::stoul(m.str(3), NULL, 10);
+ if (!m.str(4).empty())
+ oldmsgs_urgent = std::stoul(m.str(4), NULL, 10);
+
return true;
}