diff --git a/rm-main/src/ui/tabs/torrents/bottom_stats.rs b/rm-main/src/ui/tabs/torrents/bottom_stats.rs index 474648c..717c06c 100644 --- a/rm-main/src/ui/tabs/torrents/bottom_stats.rs +++ b/rm-main/src/ui/tabs/torrents/bottom_stats.rs @@ -50,9 +50,15 @@ impl Component for BottomStats { let table_manager = &*self.table_manager.lock().unwrap(); let table = table_manager.table.borrow(); let all = table.get_len(); + if let Some(current) = table.state.borrow().selected() { - let current_idx = current + 1; - text = format!(" {current_idx}/{all} | {text}"); + if all > 0 { + let current_idx = current + 1; + text = format!(" {current_idx}/{all} | {text}"); + } else { + // dont display index if no items in table + text = format!(" {all} | {text}"); + } } else { text = format!(" {all} | {text}"); }