aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2021-08-17 18:10:58 +0200
committerTobias Fella <fella@posteo.de>2021-12-01 21:56:59 +0100
commit60bd11426e941f9d349962b8b2ea4bddd9488965 (patch)
treeb8a78bcee52be0055d8eced4e3601087de86c443 /lib
parent703b3f89ef54d9d40c9117788d0920b6b745bd62 (diff)
downloadlibquotient-60bd11426e941f9d349962b8b2ea4bddd9488965.tar.gz
libquotient-60bd11426e941f9d349962b8b2ea4bddd9488965.zip
Don't crash when ToDeviceEvent decryption fails
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 4a220e0d..60ffed09 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -798,8 +798,13 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents)
qCDebug(E2EE) << "Unsupported algorithm" << event.id() << "for event" << event.algorithm();
return;
}
+ const auto decryptedEvent = sessionDecryptMessage(event);
+ if(!decryptedEvent) {
+ qCWarning(E2EE) << "Failed to decrypt event" << event.id();
+ return;
+ }
- visit(*sessionDecryptMessage(event),
+ visit(*decryptedEvent,
[this, senderKey = event.senderKey()](const RoomKeyEvent& roomKeyEvent) {
if (auto* detectedRoom = q->room(roomKeyEvent.roomId())) {
detectedRoom->handleRoomKeyEvent(roomKeyEvent, senderKey);