diff --git a/serverctl/wireguard.go b/serverctl/wireguard.go index d83fe19f..7a5f463b 100644 --- a/serverctl/wireguard.go +++ b/serverctl/wireguard.go @@ -9,6 +9,7 @@ import ( "net" "os" "strconv" + "github.com/gravitl/netmaker/database" "github.com/gravitl/netmaker/functions" "github.com/gravitl/netmaker/models" @@ -200,10 +201,9 @@ func GetPeers(networkName string) (map[string]string, error) { return nil, err } for _, peer := range device.Peers { - if functions.IsBase64(peer.PublicKey.String()) && functions.CheckEndpoint(peer.Endpoint.String()) { + if functions.IsBase64(peer.PublicKey.String()) && peer.Endpoint != nil && functions.CheckEndpoint(peer.Endpoint.String()) { peers[peer.PublicKey.String()] = peer.Endpoint.String() } } return peers, nil } -