diff --git a/retroshare-gui/src/gui/chat/ChatLobbyUserNotify.cpp b/retroshare-gui/src/gui/chat/ChatLobbyUserNotify.cpp index 00e1e2216..f8155b365 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyUserNotify.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyUserNotify.cpp @@ -100,9 +100,20 @@ QIcon ChatLobbyUserNotify::getMainIcon(bool hasNew) unsigned int ChatLobbyUserNotify::getNewCount() { int iNum=0; - for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end(); ++itCL) { - iNum+=itCL->second.size(); - if (itCL->second.size()==0) _listMsg.erase(itCL); + for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end();) + { + iNum+=itCL->second.size(); + + if (itCL->second.size()==0) + { + lobby_map::iterator ittmp = itCL ; + ++ittmp ; + + _listMsg.erase(itCL); + itCL = ittmp ; + } + else + ++itCL ; } return iNum; }