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.
This commit is contained in:
Joshua Goins
2026-01-14 21:23:51 -05:00
parent 644df80090
commit 41609749d8

View File

@@ -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