diff options
author | Loren Burkholder <55629213+LorenDB@users.noreply.github.com> | 2022-10-03 17:26:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 21:26:32 +0000 |
commit | e7d0344997032615a14af88478fb028282c68481 (patch) | |
tree | 852c4918c0bfb1908d76beb5a733192ab2be9f65 /src | |
parent | Don't strip fallbacks on plain text bodies (diff) | |
download | nheko-e7d0344997032615a14af88478fb028282c68481.tar.xz |
Fixed a crash in member list loading (#1199)
Diffstat (limited to 'src')
-rw-r--r-- | src/MemberList.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/MemberList.cpp b/src/MemberList.cpp index b0030455..916192c0 100644 --- a/src/MemberList.cpp +++ b/src/MemberList.cpp @@ -40,14 +40,17 @@ MemberListBackend::MemberListBackend(const QString &room_id, QObject *parent) void 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( QModelIndex{}, m_memberList.count(), m_memberList.count() + (int)members.size() - 1); for (const auto &member : members) - m_memberList.push_back( - {member, - ChatPage::instance()->timelineManager()->rooms()->currentRoom()->avatarUrl( - member.user_id)}); + m_memberList.push_back({member, thisRoom->avatarUrl(member.user_id)}); endInsertRows(); } |