fix: panic in TUI table selected item. focus is zero indexed (#3169)
This commit is contained in:
committed by
Antioch Peverell
parent
bde19777f0
commit
0fba087aa1
@@ -502,7 +502,7 @@ impl<T: TableViewItem<H> + PartialEq, H: Eq + Hash + Copy + Clone + 'static> Tab
|
||||
/// Returns the index of the currently selected item within the underlying
|
||||
/// storage vector.
|
||||
pub fn item(&self) -> Option<usize> {
|
||||
if self.items.is_empty() || self.focus > self.rows_to_items.len() {
|
||||
if self.items.is_empty() || self.focus >= self.rows_to_items.len() {
|
||||
None
|
||||
} else {
|
||||
Some(self.rows_to_items[self.focus])
|
||||
|
||||
Reference in New Issue
Block a user