[Client] Fix claim keys not in loop

This commit is contained in:
Christian Pauly 2020-03-20 10:46:12 +01:00
parent f40322b8d0
commit 237bd40a15

View file

@ -1729,12 +1729,6 @@ class Client {
}
}
} else {
for (int i = 0; i < deviceKeys.length; i++) {
DeviceKeys device = deviceKeys[i];
if (!data["messages"].containsKey(device.userId)) {
data["messages"][device.userId] = Map<String, dynamic>();
}
if (encrypted) {
// Create new sessions with devices if there is no existing session yet.
List<DeviceKeys> deviceKeysWithoutSession =
@ -1744,6 +1738,14 @@ class Client {
if (deviceKeysWithoutSession.isNotEmpty) {
await startOutgoingOlmSessions(deviceKeysWithoutSession);
}
}
for (int i = 0; i < deviceKeys.length; i++) {
DeviceKeys device = deviceKeys[i];
if (!data["messages"].containsKey(device.userId)) {
data["messages"][device.userId] = Map<String, dynamic>();
}
if (encrypted) {
List<olm.Session> existingSessions =
olmSessions[device.curve25519Key];
if (existingSessions == null || existingSessions.isEmpty) continue;