From 5ca40b9893f14b5f6d5cfa10738dc1a522ee0588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 17 Feb 2021 15:24:46 +0100 Subject: [PATCH] crypto: Be more forgiving when updating one-time key counts --- matrix_sdk_crypto/src/olm/account.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/matrix_sdk_crypto/src/olm/account.rs b/matrix_sdk_crypto/src/olm/account.rs index 1da6f01c..6a9cf42c 100644 --- a/matrix_sdk_crypto/src/olm/account.rs +++ b/matrix_sdk_crypto/src/olm/account.rs @@ -191,10 +191,10 @@ impl Account { } pub async fn update_uploaded_key_count(&self, key_count: &BTreeMap) { - let one_time_key_count = key_count.get(&DeviceKeyAlgorithm::SignedCurve25519); - - let count: u64 = one_time_key_count.map_or(0, |c| (*c).into()); - self.inner.update_uploaded_key_count(count); + if let Some(count) = key_count.get(&DeviceKeyAlgorithm::SignedCurve25519) { + let count: u64 = (*count).into(); + self.inner.update_uploaded_key_count(count); + } } pub async fn receive_keys_upload_response(