From 4a2faed1984b6d5a517d96fa962307e52f0badcb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 8 Sep 2020 18:27:12 +0200 Subject: [PATCH] don't assume roomKeys is an array --- src/matrix/DeviceMessageHandler.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/matrix/DeviceMessageHandler.js b/src/matrix/DeviceMessageHandler.js index e0398256..4c7d0e75 100644 --- a/src/matrix/DeviceMessageHandler.js +++ b/src/matrix/DeviceMessageHandler.js @@ -60,10 +60,12 @@ export class DeviceMessageHandler { } _applyDecryptChanges(rooms, {roomKeys}) { - const roomKeysByRoom = groupBy(roomKeys, s => s.roomId); - for (const [roomId, roomKeys] of roomKeysByRoom) { - const room = rooms.get(roomId); - room?.notifyRoomKeys(roomKeys); + if (roomKeys && roomKeys.length) { + const roomKeysByRoom = groupBy(roomKeys, s => s.roomId); + for (const [roomId, roomKeys] of roomKeysByRoom) { + const room = rooms.get(roomId); + room?.notifyRoomKeys(roomKeys); + } } }