Check if the room is valid before trying to refresh users
This commit is contained in:
@@ -163,17 +163,19 @@ void UserListModel::refreshAllUsers()
|
|||||||
}
|
}
|
||||||
m_users.clear();
|
m_users.clear();
|
||||||
|
|
||||||
m_users = m_currentRoom->users();
|
if (m_currentRoom != nullptr) {
|
||||||
std::sort(m_users.begin(), m_users.end(), m_currentRoom->memberSorter());
|
m_users = m_currentRoom->users();
|
||||||
|
std::sort(m_users.begin(), m_users.end(), m_currentRoom->memberSorter());
|
||||||
|
|
||||||
for (User *user : std::as_const(m_users)) {
|
for (User *user : std::as_const(m_users)) {
|
||||||
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
connect(user, &User::defaultAvatarChanged, this, [this, user]() {
|
||||||
refreshUser(user, {AvatarRole});
|
refreshUser(user, {AvatarRole});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this]() {
|
||||||
|
setRoom(nullptr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
connect(m_currentRoom->connection(), &Connection::loggedOut, this, [this]() {
|
|
||||||
setRoom(nullptr);
|
|
||||||
});
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
Q_EMIT usersRefreshed();
|
Q_EMIT usersRefreshed();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user