From 16c7f7b357556eb8c38a3b265fbed5e67ac77789 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:15:35 +0300 Subject: modified: utilities.cpp --- utilities.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index b066e22..83e13da 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -446,10 +446,14 @@ int onProtoAck(WPARAM w, LPARAM l) else if(ack->type == ACKTYPE_MESSAGE && ack->result == ACKRESULT_FAILED) { extern std::list sent_msgs; - std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); - if(it != sent_msgs.end()) + if(!sent_msgs.empty()) { - HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); + if(it != sent_msgs.end()) + { + HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + sent_msgs.erase(it); + } } } return 0; -- cgit v1.2.3