cmd/tailscale/cli: fix panic in netcheck print when no DERP home

Fixes #8016

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/9363/head
Brad Fitzpatrick 1 year ago committed by Brad Fitzpatrick
parent 9ee173c256
commit 668a0dd5ab

@ -153,7 +153,11 @@ func printReport(dm *tailcfg.DERPMap, report *netcheck.Report) error {
if len(report.RegionLatency) == 0 {
printf("\t* Nearest DERP: unknown (no response to latency probes)\n")
} else {
printf("\t* Nearest DERP: %v\n", dm.Regions[report.PreferredDERP].RegionName)
if report.PreferredDERP != 0 {
printf("\t* Nearest DERP: %v\n", dm.Regions[report.PreferredDERP].RegionName)
} else {
printf("\t* Nearest DERP: [none]\n")
}
printf("\t* DERP latency:\n")
var rids []int
for rid := range dm.Regions {

Loading…
Cancel
Save