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)