diff --git a/src/ui.rs b/src/ui.rs index aca5917..e374cb6 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -340,7 +340,7 @@ impl UI { } Some(UIEvent::Ports(mut p)) => { p.sort_by(|a, b| a.port.partial_cmp(&b.port).unwrap()); - if self.selection >= p.len() { + if self.selection >= p.len() && p.len() > 0 { self.selection = p.len() - 1; }