Skip to content

Commit

Permalink
fix(survey): Check for nil PeerID before deref
Browse files Browse the repository at this point in the history
  • Loading branch information
placer14 committed Jan 30, 2023
1 parent 720cc96 commit 06a37b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tasks/survey/minerprotocols/minerprotocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 06a37b0

Please sign in to comment.