Commit 9f3ffaf6 authored by Steven Allen's avatar Steven Allen

fix: rand.Intn(0) panics

parent 480b3f75
......@@ -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