From f8bc9f3dc94a5009b996d39f0c074cd5119ac879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Tue, 27 Apr 2021 11:27:34 +0200 Subject: [PATCH] matrix-sdk: handle overflow in active_members_count --- matrix_sdk_base/src/rooms/normal.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_base/src/rooms/normal.rs b/matrix_sdk_base/src/rooms/normal.rs index 54d06a50..82e9429e 100644 --- a/matrix_sdk_base/src/rooms/normal.rs +++ b/matrix_sdk_base/src/rooms/normal.rs @@ -535,7 +535,11 @@ impl RoomInfo { } /// The number of active members (invited + joined) in the room. + /// + /// The return value is saturated at `u64::MAX`. pub fn active_members_count(&self) -> u64 { - self.summary.joined_member_count + self.summary.invited_member_count + self.summary + .joined_member_count + .saturating_add(self.summary.invited_member_count) } }