Fix out of bounds panic (#16)

This commit is contained in:
Ivordir
2023-04-15 15:11:04 +00:00
committed by GitHub
parent 1119137d27
commit 0874e09c31

View File

@@ -390,6 +390,7 @@ fn activate(app: &gtk::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
Some(selected) => selected,
None => {
// If nothing is selected select either the top or bottom match based on the input
if !combined_matches.is_empty() {
match event.keyval() {
constants::Down | constants::Tab => combined_matches[0]
.1
@@ -399,6 +400,7 @@ fn activate(app: &gtk::Application, runtime_data: Rc<RefCell<Option<RuntimeData>
.select_row(Some(&combined_matches[combined_matches.len() - 1].0)),
_ => unreachable!(),
}
}
return Inhibit(true);
}
};