aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 471dc20d..a33ace51 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -2242,10 +2242,12 @@ void Connection::saveOlmAccount()
#ifdef Quotient_E2EE_ENABLED
QJsonObject Connection::decryptNotification(const QJsonObject &notification)
{
- auto r = room(notification["room_id"].toString());
- auto event = makeEvent<EncryptedEvent>(notification["event"].toObject());
- const auto decrypted = r->decryptMessage(*event);
- return decrypted ? decrypted->fullJson() : QJsonObject();
+ if (auto r = room(notification["room_id"].toString()))
+ if (auto event =
+ loadEvent<EncryptedEvent>(notification["event"].toObject()))
+ if (const auto decrypted = r->decryptMessage(*event))
+ return decrypted->fullJson();
+ return QJsonObject();
}
Database* Connection::database() const