tailcfg: NetInfo.String: handle nil object without panicing

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
pull/210/head
David Crawshaw 5 years ago
parent b6f77cc48d
commit e60b433831

@ -286,6 +286,9 @@ type NetInfo struct {
} }
func (ni *NetInfo) String() string { func (ni *NetInfo) String() string {
if ni == nil {
return "NetInfo(nil)"
}
return fmt.Sprintf("NetInfo{varies=%v hairpin=%v ipv6=%v udp=%v derp=#%v link=%q}", return fmt.Sprintf("NetInfo{varies=%v hairpin=%v ipv6=%v udp=%v derp=#%v link=%q}",
ni.MappingVariesByDestIP, ni.HairPinning, ni.WorkingIPv6, ni.MappingVariesByDestIP, ni.HairPinning, ni.WorkingIPv6,
ni.WorkingUDP, ni.PreferredDERP, ni.LinkType) ni.WorkingUDP, ni.PreferredDERP, ni.LinkType)

Loading…
Cancel
Save