Unverified Commit 536feb6d authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #144 from ipfs/fix/zero-rand

fix: rand.Intn(0) panics
parents 480b3f75 9f3ffaf6
......@@ -347,6 +347,9 @@ func (s *Session) handlePeriodicSearch(ctx context.Context) {
}
func (s *Session) randomLiveWant() cid.Cid {
if len(s.liveWants) == 0 {
return cid.Cid{}
}
i := rand.Intn(len(s.liveWants))
// picking a random live want
for k := range s.liveWants {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment