File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.
66
77## [ Unreleased] - ReleaseDate
88
9+ ### Bug Fixes
10+
11+ - Fix a panic in the ` RoomMember::normalized_power_level ` method.
12+ ([ #5635 ] ( https://github.com/matrix-org/matrix-rust-sdk/pull/5635 ) )
13+
914## [ 0.14.0] - 2025-09-04
1015
1116### Features
Original file line number Diff line number Diff line change @@ -471,7 +471,9 @@ impl RoomMemberships {
471471pub fn normalize_power_level ( power_level : Int , max_power_level : i64 ) -> Int {
472472 let mut power_level = i64:: from ( power_level) ;
473473 power_level = ( power_level * 100 ) / max_power_level;
474- power_level. try_into ( ) . expect ( "normalized power level should fit in Int" )
474+
475+ Int :: try_from ( power_level. clamp ( 0 , 100 ) )
476+ . expect ( "We clamped the normalized power level so they must fit into the Int" )
475477}
476478
477479#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments