Don't crash when trying to open a context menu on a pending event
This commit is contained in:
committed by
Tobias Fella
parent
b5351e48dd
commit
9d2ef838bb
@@ -275,8 +275,13 @@ void RoomManager::viewEventMenu(const QString &eventId, NeoChatRoom *room, Neoch
|
|||||||
qWarning() << "Tried to open event menu with empty event id";
|
qWarning() << "Tried to open event menu with empty event id";
|
||||||
return;
|
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)) {
|
if (EventHandler::mediaInfo(room, &event).contains("mimeType"_L1)) {
|
||||||
Q_EMIT showFileMenu(eventId,
|
Q_EMIT showFileMenu(eventId,
|
||||||
sender,
|
sender,
|
||||||
|
|||||||
Reference in New Issue
Block a user