From a2dab31fd6ca3728175716df2cff2dda448b2914 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Sun, 14 Feb 2021 13:01:16 +0530 Subject: Fix two room leaving related bugs and add invite user on clicking invite --- src/RoomList.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/RoomList.cpp') diff --git a/src/RoomList.cpp b/src/RoomList.cpp index 764a8e42..67a7ac40 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -106,6 +106,10 @@ void RoomList::removeRoom(const QString &room_id, bool reset) { auto roomIt = rooms_.find(room_id); + if (roomIt == rooms_.end()) { + return; + } + for (auto roomSortIt = rooms_sort_cache_.begin(); roomSortIt != rooms_sort_cache_.end(); ++roomSortIt) { if (roomIt->second == *roomSortIt) { @@ -523,8 +527,11 @@ RoomList::firstRoom() const auto item = qobject_cast(contentsLayout_->itemAt(i)->widget()); if (item) { - return std::pair>( - item->roomId(), rooms_.at(item->roomId())); + auto topRoom = rooms_.find(item->roomId()); + if (topRoom != rooms_.end()) { + return std::pair>( + item->roomId(), topRoom->second); + } } } -- cgit 1.5.1