Don't crash when there are no ports

This commit is contained in:
John Doty 2022-10-16 09:08:29 -07:00
parent 6cc17e7fca
commit 4c3c251181

View file

@ -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;
}