From: Matt Corallo Date: Fri, 23 Aug 2019 01:14:53 +0000 (-0400) Subject: Fix handling failed route lookups X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ff30d00b8e0c4723875ac1e5c313a7813a2a0b4d;p=dnsseed-rust Fix handling failed route lookups --- 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) {