matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

`OlmEncryption.encryptMessage()`: `devices` can be null

Open ShadowJonathan opened this issue 3 years ago • 0 comments

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.)

ShadowJonathan avatar May 16 '22 14:05 ShadowJonathan