Fix out of bounds panic (#16)
This commit is contained in:
@@ -390,14 +390,16 @@ fn activate(app: >k::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
|
|||||||
Some(selected) => selected,
|
Some(selected) => selected,
|
||||||
None => {
|
None => {
|
||||||
// If nothing is selected select either the top or bottom match based on the input
|
// If nothing is selected select either the top or bottom match based on the input
|
||||||
match event.keyval() {
|
if !combined_matches.is_empty() {
|
||||||
constants::Down | constants::Tab => combined_matches[0]
|
match event.keyval() {
|
||||||
.1
|
constants::Down | constants::Tab => combined_matches[0]
|
||||||
.select_row(Some(&combined_matches[0].0)),
|
.1
|
||||||
constants::Up => combined_matches[combined_matches.len() - 1]
|
.select_row(Some(&combined_matches[0].0)),
|
||||||
.1
|
constants::Up => combined_matches[combined_matches.len() - 1]
|
||||||
.select_row(Some(&combined_matches[combined_matches.len() - 1].0)),
|
.1
|
||||||
_ => unreachable!(),
|
.select_row(Some(&combined_matches[combined_matches.len() - 1].0)),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Inhibit(true);
|
return Inhibit(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user