From ab08be1e3ea61b58f2c1258bfc22be4d997a1d99 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Thu, 15 Apr 2021 09:12:21 -0500 Subject: [PATCH] Don't panic on a nil response from the lighthouse (#442) --- ssh.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ssh.go b/ssh.go index 2516ee0..c8c8e40 100644 --- a/ssh.go +++ b/ssh.go @@ -461,7 +461,12 @@ func sshQueryLighthouse(ifce *Interface, fs interface{}, a []string, w sshd.Stri return w.WriteLine(fmt.Sprintf("The provided vpn ip could not be parsed: %s", a[0])) } - return json.NewEncoder(w.GetWriter()).Encode(ifce.lightHouse.Query(vpnIp, ifce).CopyCache()) + var cm *CacheMap + rl := ifce.lightHouse.Query(vpnIp, ifce) + if rl != nil { + cm = rl.CopyCache() + } + return json.NewEncoder(w.GetWriter()).Encode(cm) } func sshCloseTunnel(ifce *Interface, fs interface{}, a []string, w sshd.StringWriter) error {