Skip to content

Commit

Permalink
Fix panic caused by the clear method of FactoryVecDeque
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>
  • Loading branch information
AaronErhardt committed Dec 31, 2021
1 parent 69248dd commit 7933cd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### Fixed

+ relm4: Fix panic caused by the clear method of FactoryVecDeque

## 0.4.0-beta.3 - 2021-12-28

### Added

+ relm4: A factory view implementation for libadwaita's StackView
Expand Down
10 changes: 4 additions & 6 deletions src/factory/collections/factory_vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,10 @@ where

/// Remove all data from the [`FactoryVecDeque`].
pub fn clear(&mut self) {
for index in 0..self.data.len() {
self.add_change(Change {
ty: ChangeType::Remove(1),
index,
})
}
self.add_change(Change {
ty: ChangeType::Remove(self.data.len() as u16),
index: 0,
});
self.data.clear();
}

Expand Down

0 comments on commit 7933cd6

Please sign in to comment.