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.
This commit is contained in:
Aleix Pol
2025-05-03 01:50:38 +02:00
committed by Aleix Pol Gonzalez
parent 7abca73339
commit df9a7292b9

View File

@@ -1660,7 +1660,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)