From 176dbbeda9f8fef999b85e88286fb7586b7d1ece Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Wed, 27 Oct 2021 11:50:06 +0200 Subject: [PATCH] fix: Do not upload keys after logout This should fix a race condition where uploading keys is still ongoing after user has already logged out. --- lib/encryption/olm_manager.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/encryption/olm_manager.dart b/lib/encryption/olm_manager.dart index 6573be08..4eda70f5 100644 --- a/lib/encryption/olm_manager.dart +++ b/lib/encryption/olm_manager.dart @@ -237,6 +237,8 @@ class OlmManager { if (updateDatabase) { await client.database?.updateClientKeys(pickledOlmAccount!); } + // Workaround: Make sure we stop if we got logged out in the meantime. + if (!client.isLogged()) return true; final response = await client.uploadKeys( deviceKeys: uploadDeviceKeys ? MatrixDeviceKeys.fromJson(keysContent['device_keys'])