Fix crash when removing the first item in a SelectView

This commit is contained in:
Alexandre Bury 2016-09-01 11:28:30 -07:00
parent f9f8fb0c75
commit 9142c545f7

View File

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