From 06a37b02d4ffd60e6e75b2391bc8944f42b1027a Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Sun, 29 Jan 2023 18:44:45 -0500 Subject: [PATCH] fix(survey): Check for nil PeerID before deref --- tasks/survey/minerprotocols/minerprotocols.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tasks/survey/minerprotocols/minerprotocols.go b/tasks/survey/minerprotocols/minerprotocols.go index a319a4f7f..2d9438ee9 100644 --- a/tasks/survey/minerprotocols/minerprotocols.go +++ b/tasks/survey/minerprotocols/minerprotocols.go @@ -147,9 +147,11 @@ func (t *Task) Close() error { func fetchMinerProtocolModel(ctx context.Context, api API, addr address.Address, minerInfo lapi.MinerInfo, start time.Time, results chan *observed.MinerProtocol) { // since miners may choose if their peerID is set in their info var peerID string - if minerInfo.PeerId != nil { - peerID = minerInfo.PeerId.String() + if minerInfo.PeerId == nil { + log.Debugw("failed with empty peer id for miner", "miner", addr) + return } + peerID = minerInfo.PeerId.String() // extract any multiaddresses the miner has set in their info, they may have none bail if that is the case. minerPeerInfo, err := getMinerAddrInfo(minerInfo)