From dee3c279e8853e3ae76167a58f1e4aef47d93a65 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Fri, 13 Jan 2023 22:11:22 +0800 Subject: [PATCH] fix crash when open invitation page --- src/userlistmodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/userlistmodel.cpp b/src/userlistmodel.cpp index 3b9217e96..beec8978c 100644 --- a/src/userlistmodel.cpp +++ b/src/userlistmodel.cpp @@ -105,6 +105,12 @@ QVariant UserListModel::data(const QModelIndex &index, int role) const #else auto pl = m_currentRoom->getCurrentState(); #endif + // User might not in the room yet, in this case pl can be nullptr. + // e.g. When invited but user not accepted or denied the invitation. + if (!pl) { + return QStringLiteral("Not Available"); + } + auto userPl = pl->powerLevelForUser(user->id()); switch (userPl) {