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); + } } }