diff --git a/src/crypto/DeviceList.js b/src/crypto/DeviceList.js index 3e7e1a4ff..b827da11c 100644 --- a/src/crypto/DeviceList.js +++ b/src/crypto/DeviceList.js @@ -68,11 +68,11 @@ export default class DeviceList { // [device info] // } // } - this._devices = null; + this._devices = {}; // which users we are tracking device status for. // userId -> TRACKING_STATUS_* - this._deviceTrackingStatus = null; // loaded from storage in load() + this._deviceTrackingStatus = {}; // loaded from storage in load() // The 'next_batch' sync token at the point the data was writen, // ie. a token represtenting the point immediately after the @@ -104,8 +104,10 @@ export default class DeviceList { this._cryptoStore.getEndToEndDeviceData(txn, (deviceData) => { if (deviceData === null) { console.log("Migrating e2e device data..."); - this._devices = this._sessionStore.getAllEndToEndDevices(); - this._deviceTrackingStatus = this._sessionStore.getEndToEndDeviceTrackingStatus(); + this._devices = this._sessionStore.getAllEndToEndDevices() || {}; + this._deviceTrackingStatus = ( + this._sessionStore.getEndToEndDeviceTrackingStatus() || {} + ); this._syncToken = this._sessionStore.getEndToEndDeviceSyncToken(); this._cryptoStore.storeEndToEndDeviceData({ devices: this._devices, diff --git a/src/crypto/index.js b/src/crypto/index.js index d1bee2fd4..9d80544b2 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -69,7 +69,9 @@ function Crypto(baseApis, sessionStore, userId, deviceId, this._cryptoStore = cryptoStore; this._olmDevice = new OlmDevice(sessionStore, cryptoStore); - this._deviceList = new DeviceList(baseApis, cryptoStore, sessionStore, this._olmDevice); + this._deviceList = new DeviceList( + baseApis, cryptoStore, sessionStore, this._olmDevice, + ); // the last time we did a check for the number of one-time-keys on the // server.