diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index bf997023f..a793497a8 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1890,6 +1890,15 @@ func (b *LocalBackend) initPeerAPIListener() { b.mu.Lock() defer b.mu.Unlock() + if b.netMap == nil { + // We're called from authReconfig which checks that + // netMap is non-nil, but if a concurrent Logout, + // ResetForClientDisconnect, or Start happens when its + // mutex was released, the netMap could be + // nil'ed out (Issue 1996). Bail out early here if so. + return + } + if len(b.netMap.Addresses) == len(b.peerAPIListeners) { allSame := true for i, pln := range b.peerAPIListeners {