From edaaa286e3649fd9c8ae4fbc1e7715a53f8f0a66 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Mon, 18 May 2020 16:45:53 +0200 Subject: [PATCH] fix decryption of some events throwing an error --- lib/src/room.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 6550be4..3a24b44 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1780,7 +1780,7 @@ class Room { /// Returns a m.bad.encrypted event if it fails and does nothing if the event /// was not encrypted. Event decryptGroupMessage(Event event) { - if (event.type != EventTypes.Encrypted) return event; + if (event.type != EventTypes.Encrypted || event.content['ciphertext'] == null) return event; Map decryptedPayload; try { if (!client.encryptionEnabled) { @@ -1820,7 +1820,7 @@ class Room { decryptedPayload['content']['msgtype'] = 'm.bad.encrypted'; } else { decryptedPayload = { - 'content': { + 'content': { 'msgtype': 'm.bad.encrypted', 'body': exception.toString(), },