mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
Fix possible panic in ListView
This commit is contained in:
parent
420454cc0f
commit
e7ee525bb6
@ -231,6 +231,10 @@ impl ListView {
|
|||||||
|
|
||||||
// Now that we have a relative position, checks for buttons?
|
// Now that we have a relative position, checks for buttons?
|
||||||
let focus = position.y + self.scrollbase.start_line;
|
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 let ListChild::Row(_, ref mut view) = self.children[focus] {
|
||||||
if view.take_focus(direction::Direction::none()) {
|
if view.take_focus(direction::Direction::none()) {
|
||||||
self.focus = focus;
|
self.focus = focus;
|
||||||
|
Loading…
Reference in New Issue
Block a user