mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix crash when removing the first item in a SelectView
This commit is contained in:
parent
f9f8fb0c75
commit
9142c545f7
@ -199,7 +199,7 @@ impl<T: 'static> SelectView<T> {
|
|||||||
pub fn remove_item(&mut self, id: usize) {
|
pub fn remove_item(&mut self, id: usize) {
|
||||||
self.items.remove(id);
|
self.items.remove(id);
|
||||||
let focus = self.focus();
|
let focus = self.focus();
|
||||||
if focus >= id {
|
if focus >= id && focus > 0 {
|
||||||
self.focus.set(focus - 1);
|
self.focus.set(focus - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user