Skip to content

Commit

Permalink
Merge pull request #862 from uhoreg/check_resolver
Browse files Browse the repository at this point in the history
make sure resolve object is defined before calling it
  • Loading branch information
uhoreg authored Mar 20, 2019
2 parents 6a57ddd + bd711cd commit d5c6dcf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/crypto/olmlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,24 @@ module.exports.ensureOlmSessionsForDevices = async function(
const msg = "No one-time keys (alg=" + oneTimeKeyAlgorithm +
") for device " + userId + ":" + deviceId;
logger.warn(msg);
resolveSession[key].resolve();
if (resolveSession[key]) {
resolveSession[key].resolve();
}
continue;
}

promises.push(
_verifyKeyAndStartSession(
olmDevice, oneTimeKey, userId, deviceInfo,
).then((sid) => {
resolveSession[key].resolve(sid);
if (resolveSession[key]) {
resolveSession[key].resolve(sid);
}
result[userId][deviceId].sessionId = sid;
}, (e) => {
resolveSession[key].resolve();
if (resolveSession[key]) {
resolveSession[key].resolve();
}
throw e;
}),
);
Expand Down

0 comments on commit d5c6dcf

Please sign in to comment.