Don't crash when trying to open a context menu on a pending event

This commit is contained in:
Tobias Fella
2025-08-03 18:07:55 +02:00
committed by Tobias Fella
parent b5351e48dd
commit 9d2ef838bb

View File

@@ -275,8 +275,13 @@ void RoomManager::viewEventMenu(const QString &eventId, NeoChatRoom *room, Neoch
qWarning() << "Tried to open event menu with empty event id";
return;
}
const auto &event = **room->findInTimeline(eventId);
const auto it = room->findInTimeline(eventId);
if (it == room->historyEdge()) {
// This is probably a pending event
return;
}
const auto &event = **it;
if (EventHandler::mediaInfo(room, &event).contains("mimeType"_L1)) {
Q_EMIT showFileMenu(eventId,
sender,