diff --git a/session/session.go b/session/session.go index 0fbe8d2d..88b213bf 100644 --- a/session/session.go +++ b/session/session.go @@ -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 {