From df9a7292b9b93c2ec4aee620dbd87f26330e378b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sat, 3 May 2025 01:50:38 +0200 Subject: [PATCH] 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. --- src/libneochat/neochatroom.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libneochat/neochatroom.cpp b/src/libneochat/neochatroom.cpp index 567476bf5..60325613a 100644 --- a/src/libneochat/neochatroom.cpp +++ b/src/libneochat/neochatroom.cpp @@ -1660,7 +1660,11 @@ void NeoChatRoom::cleanupExtraEvent(const QString &eventId) } QString NeoChatRoom::invitingUserId() const { - return currentState().get(connection()->userId())->senderId(); + auto event = currentState().get(connection()->userId()); + if (!event) { + return {}; + } + return event->senderId(); } void NeoChatRoom::setRoomState(const QString &type, const QString &stateKey, const QByteArray &content)