From 94d1bb2c624ca9a689a5d7cdca8af6ef5e489150 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 22 Sep 2022 20:41:26 +0200 Subject: Don't crash in MxcReply if the event is not a RoomMessageEvent --- lib/mxcreply.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/mxcreply.cpp b/lib/mxcreply.cpp index c7547be8..ce833b98 100644 --- a/lib/mxcreply.cpp +++ b/lib/mxcreply.cpp @@ -63,10 +63,11 @@ MxcReply::MxcReply(QNetworkReply* reply, Room* room, const QString &eventId) #ifdef Quotient_E2EE_ENABLED auto eventIt = room->findInTimeline(eventId); if(eventIt != room->historyEdge()) { - auto event = eventIt->viewAs(); - if (auto* efm = std::get_if( - &event->content()->fileInfo()->source)) - d->m_encryptedFile = *efm; + if (auto event = eventIt->viewAs()) { + if (auto* efm = std::get_if( + &event->content()->fileInfo()->source)) + d->m_encryptedFile = *efm; + } } #endif } -- cgit v1.2.3