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; const {userIdentities} = txn;
if (Array.isArray(deviceLists.changed) && deviceLists.changed.length) { if (Array.isArray(deviceLists.changed) && deviceLists.changed.length) {
await Promise.all(deviceLists.changed.map(async userId => { await Promise.all(deviceLists.changed.map(async userId => {
const user = await userIdentities.get(userId) const user = await userIdentities.get(userId);
if (user) {
user.deviceTrackingStatus = TRACKING_STATUS_OUTDATED; user.deviceTrackingStatus = TRACKING_STATUS_OUTDATED;
userIdentities.set(user); userIdentities.set(user);
} else {
console.warn("changed device userid not found", userId);
}
})); }));
} }
} }