Don't panic on a nil response from the lighthouse (#442)

This commit is contained in:
Nathan Brown 2021-04-15 09:12:21 -05:00 committed by GitHub
parent 710df6a876
commit ab08be1e3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

7
ssh.go
View File

@ -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 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 { func sshCloseTunnel(ifce *Interface, fs interface{}, a []string, w sshd.StringWriter) error {