From ff30d00b8e0c4723875ac1e5c313a7813a2a0b4d Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 22 Aug 2019 21:14:53 -0400 Subject: [PATCH] Fix handling failed route lookups --- src/bgp_client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bgp_client.rs b/src/bgp_client.rs index cb33305..a890dad 100644 --- a/src/bgp_client.rs +++ b/src/bgp_client.rs @@ -182,7 +182,7 @@ impl BGPClient { .then(path_b.med.cmp(&path_a.med)) }); // TODO: Find last common ASN among all paths - *path_vecs[0].path.last().unwrap_or(&0) + *path_vecs.first().map(|route| route.path.last().unwrap_or(&0)).unwrap_or(&0) } pub fn disconnect(&self) { -- 2.39.5