fix: missing null check
It seems `device_keys` in the reply of `/keys/query` is not required. While synapse always sent it, conduit did not, which resulted in an error.
This commit is contained in:
parent
7155500594
commit
56817df437
|
|
@ -1663,15 +1663,17 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
final response = await queryKeys(outdatedLists, timeout: 10000);
|
final response = await queryKeys(outdatedLists, timeout: 10000);
|
||||||
if (!isLogged()) return;
|
if (!isLogged()) return;
|
||||||
|
|
||||||
|
if (response.deviceKeys != null) {
|
||||||
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
for (final rawDeviceKeyListEntry in response.deviceKeys.entries) {
|
||||||
final userId = rawDeviceKeyListEntry.key;
|
final userId = rawDeviceKeyListEntry.key;
|
||||||
if (!userDeviceKeys.containsKey(userId)) {
|
if (!userDeviceKeys.containsKey(userId)) {
|
||||||
_userDeviceKeys[userId] = DeviceKeysList(userId, this);
|
_userDeviceKeys[userId] = DeviceKeysList(userId, this);
|
||||||
}
|
}
|
||||||
final oldKeys =
|
final oldKeys = Map<String, DeviceKeys>.from(
|
||||||
Map<String, DeviceKeys>.from(_userDeviceKeys[userId].deviceKeys);
|
_userDeviceKeys[userId].deviceKeys);
|
||||||
_userDeviceKeys[userId].deviceKeys = {};
|
_userDeviceKeys[userId].deviceKeys = {};
|
||||||
for (final rawDeviceKeyEntry in rawDeviceKeyListEntry.value.entries) {
|
for (final rawDeviceKeyEntry
|
||||||
|
in rawDeviceKeyListEntry.value.entries) {
|
||||||
final deviceId = rawDeviceKeyEntry.key;
|
final deviceId = rawDeviceKeyEntry.key;
|
||||||
|
|
||||||
// Set the new device key for this device
|
// Set the new device key for this device
|
||||||
|
|
@ -1729,8 +1731,9 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
|
||||||
}
|
}
|
||||||
_userDeviceKeys[userId].outdated = false;
|
_userDeviceKeys[userId].outdated = false;
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
dbActions
|
dbActions.add(
|
||||||
.add(() => database.storeUserDeviceKeysInfo(id, userId, false));
|
() => database.storeUserDeviceKeysInfo(id, userId, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// next we parse and persist the cross signing keys
|
// next we parse and persist the cross signing keys
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue