Skip to content

Commit

Permalink
Initial fix for crash during message processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Mar 8, 2017
1 parent 12fc9c2 commit 7d79026
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions TemplePlus/messages/messagequeue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ void MessageQueue::Enqueue(const TigMsgBase& msg) {
bool MessageQueue::Process(Message &unhandledMsgOut) {

while (!mQueue.empty()) {
const auto& msg = mQueue.front();
auto msg = mQueue.front();
mQueue.pop_front();

if (!HandleMessage(msg)) {
unhandledMsgOut = msg;
mQueue.pop_front();
return true;
}

mQueue.pop_front();
}

return false;
Expand Down Expand Up @@ -76,7 +74,7 @@ bool MessageQueue::HandleMessage(const Message& msg) {
void MessageQueue::ProcessMessages()
{
TigMsg msg;
while (!Process(msg))
while (!mQueue.empty() && !Process(msg))
;
}

Expand Down

0 comments on commit 7d79026

Please sign in to comment.