fix: Missing null checks in syncUpdate handling

This commit is contained in:
Christian Pauly 2021-07-27 10:49:50 +02:00
parent 46b2f8898e
commit e8d511a371
3 changed files with 3 additions and 1 deletions

View File

@ -233,6 +233,7 @@ class SSSS {
final accountDataType = EventTypes.secretStorageKey(keyId);
// noooow we set the account data
final waitForAccountData = client.onSync.stream.firstWhere((syncUpdate) =>
syncUpdate.accountData != null &&
syncUpdate.accountData
.any((accountData) => accountData.type == accountDataType));
await client.setAccountData(

View File

@ -290,6 +290,7 @@ class Bootstrap {
// alright, we re-encrypted all the secrets. We delete the dead weight only *after* we set our key to the default key
}
final updatedAccountData = client.onSync.stream.firstWhere((syncUpdate) =>
syncUpdate.accountData != null &&
syncUpdate.accountData.any((accountData) =>
accountData.type == EventTypes.SecretStorageDefaultKey));
await encryption.ssss.setDefaultKeyId(newSsssKey.keyId);

View File

@ -647,7 +647,7 @@ class Client extends MatrixApi {
filter: '{"room":{"include_leave":true,"timeline":{"limit":10}}}',
timeout: 0,
);
if (syncResp.rooms.leave is Map<String, dynamic>) {
if (syncResp.rooms?.leave != null) {
for (final entry in syncResp.rooms.leave.entries) {
final id = entry.key;
final room = entry.value;