Check if the room is valid before trying to refresh users

This commit is contained in:
Joshua Goins
2023-08-19 17:19:19 -04:00
parent ba116460d5
commit e48cfaa41f

View File

@@ -163,6 +163,7 @@ void UserListModel::refreshAllUsers()
}
m_users.clear();
if (m_currentRoom != nullptr) {
m_users = m_currentRoom->users();
std::sort(m_users.begin(), m_users.end(), m_currentRoom->memberSorter());
@@ -174,6 +175,7 @@ void UserListModel::refreshAllUsers()
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this]() {
setRoom(nullptr);
});
}
endResetModel();
Q_EMIT usersRefreshed();
}