ipn/ipnlocal: fix a nil pointer dereference when serving /localapi/v0/tka/status

Fixes #13330

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl 2024-08-30 22:26:04 -05:00 committed by Nick Khyl
parent 3d9e3a17fa
commit 2f2aeaeaeb

View File

@ -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()