don't crash when tracked user is not there

This commit is contained in:
Bruno Windels 2020-08-31 16:06:40 +02:00
parent fef6586e5b
commit d43cdfd889

View file

@ -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);
}
}));
}
}