aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-09-22 20:41:26 +0200
committerTobias Fella <fella@posteo.de>2022-09-23 20:08:18 +0200
commit94d1bb2c624ca9a689a5d7cdca8af6ef5e489150 (patch)
tree01719a04d8bd837aa037a9bffe82aec0f018dcbc /lib
parentb1de80b4169d5f60f0f1f7fd20018ba6521c293e (diff)
downloadlibquotient-94d1bb2c624ca9a689a5d7cdca8af6ef5e489150.tar.gz
libquotient-94d1bb2c624ca9a689a5d7cdca8af6ef5e489150.zip
Don't crash in MxcReply if the event is not a RoomMessageEvent
Diffstat (limited to 'lib')
-rw-r--r--lib/mxcreply.cpp9
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
}