Fixes a null pointer call

It seems like the case is possible as we already are treating the case
in isUserBanned. Doesn't seem ideal as it shows "" where the username
should be but it's better than a crash.


(cherry picked from commit df9a7292b9)

Co-authored-by: Aleix Pol <aleixpol@kde.org>
This commit is contained in:
Aleix Pol Gonzalez
2025-05-04 14:46:32 +00:00
parent 0a7fccaa5c
commit 0bf4c280bd

View File

@@ -1671,7 +1671,11 @@ void NeoChatRoom::cleanupExtraEvent(const QString &eventId)
}
QString NeoChatRoom::invitingUserId() const
{
return currentState().get<RoomMemberEvent>(connection()->userId())->senderId();
auto event = currentState().get<RoomMemberEvent>(connection()->userId());
if (!event) {
return {};
}
return event->senderId();
}
void NeoChatRoom::setRoomState(const QString &type, const QString &stateKey, const QByteArray &content)