don't assume roomKeys is an array

This commit is contained in:
Bruno Windels 2020-09-08 18:27:12 +02:00
parent 4c1aaaf416
commit 4a2faed198

View File

@ -60,12 +60,14 @@ export class DeviceMessageHandler {
} }
_applyDecryptChanges(rooms, {roomKeys}) { _applyDecryptChanges(rooms, {roomKeys}) {
if (roomKeys && roomKeys.length) {
const roomKeysByRoom = groupBy(roomKeys, s => s.roomId); const roomKeysByRoom = groupBy(roomKeys, s => s.roomId);
for (const [roomId, roomKeys] of roomKeysByRoom) { for (const [roomId, roomKeys] of roomKeysByRoom) {
const room = rooms.get(roomId); const room = rooms.get(roomId);
room?.notifyRoomKeys(roomKeys); room?.notifyRoomKeys(roomKeys);
} }
} }
}
// not safe to call multiple times without awaiting first call // not safe to call multiple times without awaiting first call
async decryptPending(rooms) { async decryptPending(rooms) {