fix decryption of some events throwing an error

This commit is contained in:
Sorunome 2020-05-18 16:45:53 +02:00
parent d69277480e
commit edaaa286e3
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C

View file

@ -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<String, dynamic> decryptedPayload;
try {
if (!client.encryptionEnabled) {
@ -1820,7 +1820,7 @@ class Room {
decryptedPayload['content']['msgtype'] = 'm.bad.encrypted';
} else {
decryptedPayload = {
'content': {
'content': <String, dynamic>{
'msgtype': 'm.bad.encrypted',
'body': exception.toString(),
},