From 41609749d8bd1fac5e40362a2ef5289cb727e03d Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Wed, 14 Jan 2026 21:23:51 -0500 Subject: [PATCH] Fix a crash when grabbing relationAuthor There's a bug in how we're using this function in room search, but we definitely don't want it to crash. The event is technically not in the timeline, so we were dereferencing an invalid iterator or whatever. --- src/libneochat/chatbarcache.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libneochat/chatbarcache.cpp b/src/libneochat/chatbarcache.cpp index 35bd9c86a..2770ab8bf 100644 --- a/src/libneochat/chatbarcache.cpp +++ b/src/libneochat/chatbarcache.cpp @@ -150,7 +150,12 @@ Quotient::RoomMember ChatBarCache::relationAuthor() const if (m_relationId.isEmpty()) { return room->member(QString()); } - return room->member((*room->findInTimeline(m_relationId))->senderId()); + const auto evtIt = room->findInTimeline(m_relationId); + if (evtIt != room->messageEvents().rend()) { + return room->member((*evtIt)->senderId()); + } + qWarning() << "Failed to find relation" << m_relationId << "in timeline?"; + return room->member(QString()); } bool ChatBarCache::relationAuthorIsPresent() const