refactor: Use tryGet in handleRoomEvents

This commit is contained in:
Christian Pauly 2022-06-30 15:33:20 +02:00
parent edc86aa26c
commit 211c366662
1 changed files with 5 additions and 2 deletions

View File

@ -1793,8 +1793,11 @@ class Client extends MatrixApi {
// man-in-the-middle attacks! // man-in-the-middle attacks!
if ((event.type == EventTypes.Encryption && if ((event.type == EventTypes.Encryption &&
room.encrypted && room.encrypted &&
event.content['algorithm'] != event.content.tryGet<String>('algorithm') !=
room.getState(EventTypes.Encryption)?.content['algorithm'])) { room
.getState(EventTypes.Encryption)
?.content
.tryGet<String>('algorithm'))) {
return; return;
} }