don't assume device lists are set in sync response

This commit is contained in:
Bruno Windels 2021-02-22 11:20:51 +01:00
parent 3a8badb3e7
commit f0d9d13f4e

View File

@ -393,8 +393,8 @@ export class Session {
changes.e2eeAccountChanges = this._e2eeAccount.writeSync(deviceOneTimeKeysCount, txn, log);
}
const deviceLists = syncResponse.device_lists;
if (this._deviceTracker && Array.isArray(deviceLists.changed) && deviceLists.changed.length) {
const deviceLists = syncResponse?.device_lists;
if (this._deviceTracker && Array.isArray(deviceLists?.changed) && deviceLists.changed.length) {
await log.wrap("deviceLists", log => this._deviceTracker.writeDeviceChanges(deviceLists.changed, txn, log));
}