fix crash when open invitation page

This commit is contained in:
Gary Wang
2023-01-13 22:11:22 +08:00
parent 94427280d8
commit dee3c279e8

View File

@@ -105,6 +105,12 @@ QVariant UserListModel::data(const QModelIndex &index, int role) const
#else
auto pl = m_currentRoom->getCurrentState<RoomPowerLevelsEvent>();
#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) {