Fix possible panic in ListView

This commit is contained in:
Alexandre Bury 2017-10-14 23:08:18 -07:00
parent 420454cc0f
commit e7ee525bb6

View File

@ -231,6 +231,10 @@ impl ListView {
// Now that we have a relative position, checks for buttons?
let focus = position.y + self.scrollbase.start_line;
if focus >= self.children.len() {
return;
}
if let ListChild::Row(_, ref mut view) = self.children[focus] {
if view.take_focus(direction::Direction::none()) {
self.focus = focus;