From 669aecf4e667846f39a43bf968e6ef3741d70c02 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 21 Sep 2016 15:05:27 +0100 Subject: [PATCH] E2E: Fix NPE in getEventSenderDeviceInfo --- lib/crypto/index.js | 5 +++++ 1 file changed, 5 insertions(+) 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,