From 9da4bb58aee12380992f616742b2b91cd7382dfc Mon Sep 17 00:00:00 2001 From: Nate Sales Date: Fri, 30 Oct 2020 22:04:12 -0700 Subject: [PATCH] add PeeringDB check --- parser.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parser.go b/parser.go index 354b1be7..8f3df80f 100644 --- a/parser.go +++ b/parser.go @@ -115,6 +115,10 @@ func getPeeringDbData(asn uint32) PeeringDbData { log.Fatalf("PeeringDB JSON Unmarshal: %v", err) } + if len(peeringDbResponse.Data) < 1 { + log.Fatalf("Peer %d doesn't have a valid PeeringDB entry. Try import-valid or ask the network to update their account.", asn) + } + return peeringDbResponse.Data[0] // TODO: Add a check here }