mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
Merge branch 'fix-panic-on-no-rooms-joined-sync-v5' into 'next'
fix(sync v5): fix underflow when clamping room list indexes & allow empty range Closes #476 See merge request famedly/conduit!753
This commit is contained in:
commit
8ee8ea3e45
1 changed files with 6 additions and 3 deletions
|
@ -1531,10 +1531,13 @@ pub async fn sync_events_v5_route(
|
|||
let mut new_known_rooms = BTreeSet::new();
|
||||
|
||||
for (mut start, mut end) in list.ranges {
|
||||
start = start.clamp(uint!(0), UInt::from(all_joined_rooms.len() as u32 - 1));
|
||||
end = end.clamp(start, UInt::from(all_joined_rooms.len() as u32 - 1));
|
||||
start = start.clamp(
|
||||
uint!(0),
|
||||
UInt::from(all_joined_rooms.len().saturating_sub(1) as u32),
|
||||
);
|
||||
end = end.clamp(start, UInt::from(all_joined_rooms.len() as u32));
|
||||
let room_ids =
|
||||
all_joined_rooms[(u64::from(start) as usize)..=(u64::from(end) as usize)].to_vec();
|
||||
all_joined_rooms[(u64::from(start) as usize)..(u64::from(end) as usize)].to_vec();
|
||||
new_known_rooms.extend(room_ids.iter().cloned());
|
||||
for room_id in &room_ids {
|
||||
let todo_room =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue