add nil check in Score function

necessary for when the score is not specified in gossipsub router.
This commit is contained in:
vyzo 2020-03-08 01:54:40 +02:00
parent 398fb82e5f
commit b1aff8d752

View File

@ -138,6 +138,10 @@ func (ps *peerScore) Start(gs *GossipSubRouter) {
}
func (ps *peerScore) Score(p peer.ID) float64 {
if ps == nil {
return 0
}
ps.Lock()
defer ps.Unlock()