diff --git a/lib/crypto/index.js b/lib/crypto/index.js index 68f240acb..503e88a11 100644 --- a/lib/crypto/index.js +++ b/lib/crypto/index.js @@ -633,6 +633,11 @@ Crypto.prototype.getEventSenderDeviceInfo = function(event) { event.getSender(), algorithm, sender_key ); + if (device === null) { + // we haven't downloaded the details of this device yet. + return null; + } + // so far so good, but now we need to check that the sender of this event // hadn't advertised someone else's Curve25519 key as their own. We do that // by checking the Ed25519 claimed by the event (or, in the case of megolm,