cmd/natc: fix nil pointer

Fixes #13432

Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
Fran Bull 2024-09-10 13:20:06 -07:00 committed by franbull
parent 436a0784a2
commit 7d16af8d95

View File

@ -489,6 +489,9 @@ type perPeerState struct {
func (ps *perPeerState) domainForIP(ip netip.Addr) (_ string, ok bool) { func (ps *perPeerState) domainForIP(ip netip.Addr) (_ string, ok bool) {
ps.mu.Lock() ps.mu.Lock()
defer ps.mu.Unlock() defer ps.mu.Unlock()
if ps.addrToDomain == nil {
return "", false
}
return ps.addrToDomain.Lookup(ip) return ps.addrToDomain.Lookup(ip)
} }