diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-09-23 21:39:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-23 21:39:14 +0200 |
commit | 4cf39fa778e2d850586d37bfc3357a6bc5042227 (patch) | |
tree | 01719a04d8bd837aa037a9bffe82aec0f018dcbc /lib | |
parent | b1de80b4169d5f60f0f1f7fd20018ba6521c293e (diff) | |
parent | 94d1bb2c624ca9a689a5d7cdca8af6ef5e489150 (diff) | |
download | libquotient-4cf39fa778e2d850586d37bfc3357a6bc5042227.tar.gz libquotient-4cf39fa778e2d850586d37bfc3357a6bc5042227.zip |
Merge pull request #570 from quotient-im/tobias/mxcreply_no_roommessageevent
Don't crash in MxcReply if the event is not a RoomMessageEvent
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mxcreply.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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<RoomMessageEvent>(); - if (auto* efm = std::get_if<EncryptedFileMetadata>( - &event->content()->fileInfo()->source)) - d->m_encryptedFile = *efm; + if (auto event = eventIt->viewAs<RoomMessageEvent>()) { + if (auto* efm = std::get_if<EncryptedFileMetadata>( + &event->content()->fileInfo()->source)) + d->m_encryptedFile = *efm; + } } #endif } |