From d43cdfd8896dd052fd199e6aa7119f8d8a94b61c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 31 Aug 2020 16:06:40 +0200 Subject: [PATCH] don't crash when tracked user is not there --- src/matrix/e2ee/DeviceTracker.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/matrix/e2ee/DeviceTracker.js b/src/matrix/e2ee/DeviceTracker.js index 3c64f81f..5eaa23b7 100644 --- a/src/matrix/e2ee/DeviceTracker.js +++ b/src/matrix/e2ee/DeviceTracker.js @@ -47,9 +47,13 @@ export class DeviceTracker { const {userIdentities} = txn; if (Array.isArray(deviceLists.changed) && deviceLists.changed.length) { await Promise.all(deviceLists.changed.map(async userId => { - const user = await userIdentities.get(userId) - user.deviceTrackingStatus = TRACKING_STATUS_OUTDATED; - userIdentities.set(user); + const user = await userIdentities.get(userId); + if (user) { + user.deviceTrackingStatus = TRACKING_STATUS_OUTDATED; + userIdentities.set(user); + } else { + console.warn("changed device userid not found", userId); + } })); } }