From 7c99a1763b49436a993bcb9926affe0a6df414e6 Mon Sep 17 00:00:00 2001 From: Sonia Appasamy Date: Tue, 14 Nov 2023 14:14:18 -0500 Subject: [PATCH] client/web: fix panic on logout Fix panic due to `CurrentTailnet` being nil. Fixes tailscale/corp#15791 Signed-off-by: Sonia Appasamy --- client/web/web.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/web/web.go b/client/web/web.go index 3852c9df1..7e56c365d 100644 --- a/client/web/web.go +++ b/client/web/web.go @@ -567,8 +567,6 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) { ID: st.Self.ID, Status: st.BackendState, DeviceName: strings.Split(st.Self.DNSName, ".")[0], - TailnetName: st.CurrentTailnet.MagicDNSSuffix, - DomainName: st.CurrentTailnet.Name, OS: st.Self.OS, IPNVersion: strings.Split(st.Version, "-")[0], Profile: st.User[st.Self.UserID], @@ -594,6 +592,10 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) { break } } + if st.CurrentTailnet != nil { + data.TailnetName = st.CurrentTailnet.MagicDNSSuffix + data.DomainName = st.CurrentTailnet.Name + } if st.Self.Tags != nil { data.Tags = st.Self.Tags.AsSlice() }