mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Fixed a crash in member list loading (#1199)
This commit is contained in:
parent
33403d650a
commit
e7d0344997
1 changed files with 7 additions and 4 deletions
|
@ -40,14 +40,17 @@ MemberListBackend::MemberListBackend(const QString &room_id, QObject *parent)
|
||||||
void
|
void
|
||||||
MemberListBackend::addUsers(const std::vector<RoomMember> &members)
|
MemberListBackend::addUsers(const std::vector<RoomMember> &members)
|
||||||
{
|
{
|
||||||
|
auto thisRoom = ChatPage::instance()->timelineManager()->rooms()->getRoomById(room_id_);
|
||||||
|
if (thisRoom.isNull()) {
|
||||||
|
nhlog::ui()->error("Could not load the current room");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
beginInsertRows(
|
beginInsertRows(
|
||||||
QModelIndex{}, m_memberList.count(), m_memberList.count() + (int)members.size() - 1);
|
QModelIndex{}, m_memberList.count(), m_memberList.count() + (int)members.size() - 1);
|
||||||
|
|
||||||
for (const auto &member : members)
|
for (const auto &member : members)
|
||||||
m_memberList.push_back(
|
m_memberList.push_back({member, thisRoom->avatarUrl(member.user_id)});
|
||||||
{member,
|
|
||||||
ChatPage::instance()->timelineManager()->rooms()->currentRoom()->avatarUrl(
|
|
||||||
member.user_id)});
|
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue