matrix-sdk: handle overflow in active_members_count

master
Kévin Commaille 2021-04-27 11:27:34 +02:00
parent 24e96df7ea
commit f8bc9f3dc9
No known key found for this signature in database
GPG Key ID: 296D60AE1E61661C
1 changed files with 5 additions and 1 deletions

View File

@ -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)
}
}