From 2f2aeaeaebc4b3a3441e7dd35b9a01ead56e7056 Mon Sep 17 00:00:00 2001 From: Nick Khyl Date: Fri, 30 Aug 2024 22:26:04 -0500 Subject: [PATCH] ipn/ipnlocal: fix a nil pointer dereference when serving /localapi/v0/tka/status Fixes #13330 Signed-off-by: Nick Khyl --- ipn/ipnlocal/network-lock.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ipn/ipnlocal/network-lock.go b/ipn/ipnlocal/network-lock.go index 6b64ea625..b27b6427a 100644 --- a/ipn/ipnlocal/network-lock.go +++ b/ipn/ipnlocal/network-lock.go @@ -538,10 +538,13 @@ func (b *LocalBackend) NetworkLockStatus() *ipnstate.NetworkLockStatus { filtered[i] = b.tka.filtered[i].Clone() } - visible := make([]*ipnstate.TKAPeer, len(b.netMap.Peers)) - for i, p := range b.netMap.Peers { - s := tkaStateFromPeer(p) - visible[i] = &s + var visible []*ipnstate.TKAPeer + if b.netMap != nil { + visible = make([]*ipnstate.TKAPeer, len(b.netMap.Peers)) + for i, p := range b.netMap.Peers { + s := tkaStateFromPeer(p) + visible[i] = &s + } } stateID1, _ := b.tka.authority.StateIDs()