matrix-js-sdk
matrix-js-sdk copied to clipboard
`OlmEncryption.encryptMessage()`: `devices` can be null
This came up while iterating #2137;
In OlmEncryption.encryptMessage, when iterating over devices per user, the function calls getStoredDevicesForUser, which can return null.
This does not throw an error, as any comparison operation with undefined is false.
https://github.com/matrix-org/matrix-js-sdk/blob/c1abab688f9b524944c19d7d8486eb27a263e743/src/crypto/algorithms/olm.ts#L123
(Looking further into the code, I'm not sure if this is a real bug, or if this is (accidental) intended behavior.)