Commit f276a82f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed crash in deleteChatRoom

parent 22986f18
......@@ -75,12 +75,13 @@ void CorePrivate::insertChatRoom (const shared_ptr<ChatRoom> &chatRoom) {
void CorePrivate::deleteChatRoom (const string &peerAddress) {
auto it = chatRoomsByUri.find(peerAddress);
if (it != chatRoomsByUri.end())
chatRooms.erase(
find_if(chatRooms.begin(), chatRooms.end(), [&peerAddress](const shared_ptr<const ChatRoom> &chatRoom) {
return peerAddress == chatRoom->getPeerAddress().asStringUriOnly();
})
);
if (it != chatRoomsByUri.end()) {
auto it = find_if(chatRooms.begin(), chatRooms.end(), [&peerAddress](const shared_ptr<const ChatRoom> &chatRoom) {
return peerAddress == chatRoom->getPeerAddress().asStringUriOnly();
});
if (it == chatRooms.end()) return;
chatRooms.erase(it);
}
}
void CorePrivate::insertChatRoomWithDb (const shared_ptr<ChatRoom> &chatRoom) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment