Skip to content

Commit 06a37b0

Browse files
committed
fix(survey): Check for nil PeerID before deref
1 parent 720cc96 commit 06a37b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tasks/survey/minerprotocols/minerprotocols.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,11 @@ func (t *Task) Close() error {
147147
func fetchMinerProtocolModel(ctx context.Context, api API, addr address.Address, minerInfo lapi.MinerInfo, start time.Time, results chan *observed.MinerProtocol) {
148148
// since miners may choose if their peerID is set in their info
149149
var peerID string
150-
if minerInfo.PeerId != nil {
151-
peerID = minerInfo.PeerId.String()
150+
if minerInfo.PeerId == nil {
151+
log.Debugw("failed with empty peer id for miner", "miner", addr)
152+
return
152153
}
154+
peerID = minerInfo.PeerId.String()
153155

154156
// extract any multiaddresses the miner has set in their info, they may have none bail if that is the case.
155157
minerPeerInfo, err := getMinerAddrInfo(minerInfo)

0 commit comments

Comments
 (0)