Commit 43947bee authored by Ronan's avatar Ronan
Browse files

fix(Core): more robust deleteChatRoom impl

parent f3372287
......@@ -79,8 +79,28 @@ void CorePrivate::deleteChatRoom (const string &peerAddress) {
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);
if (it != chatRooms.end()) {
chatRooms.erase(it);
return;
}
// TODO: Remove me, temp workaround.
string workaroundAddress;
{
Address address(peerAddress);
address.setDomain(Address(linphone_core_get_conference_factory_uri(cCore)).getDomain());
workaroundAddress = address.asStringUriOnly();
}
lWarning() << "We don't find the chat room with address " << peerAddress <<
" as a temporary workaround, searching with " << workaroundAddress;
it = find_if(chatRooms.begin(), chatRooms.end(), [&workaroundAddress](const shared_ptr<const ChatRoom> &chatRoom) {
return workaroundAddress == chatRoom->getPeerAddress().asStringUriOnly();
});
if (it != chatRooms.end())
chatRooms.erase(it);
else
lError() << "Unable to remove chat room: " << peerAddress;
}
}
......
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