diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index 519759deb..d1a55b091 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -1105,6 +1105,9 @@ func (c *Client) checkCaptivePortal(ctx context.Context, dm *tailcfg.DERPMap, pr } rids = append(rids, id) } + if len(rids) == 0 { + return false, nil + } preferredDERP = rids[rand.Intn(len(rids))] }