From 4c3c251181524b47579edcd21daf767c56ca80ca Mon Sep 17 00:00:00 2001 From: John Doty Date: Sun, 16 Oct 2022 09:08:29 -0700 Subject: [PATCH] Don't crash when there are no ports --- src/ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }