pkg/mesh: fix segfault in #36

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín 2020-02-22 22:15:56 +01:00
parent ba00b6c180
commit 409d738124
No known key found for this signature in database
GPG Key ID: 586FEAF680DA74AD
1 changed files with 2 additions and 3 deletions

View File

@ -759,9 +759,8 @@ func (m *Mesh) resolveEndpoints() error {
if !m.peers[k].Ready() {
continue
}
// If the peer is ready, then the endpoint is not nil
// but it may not have a DNS name.
if m.peers[k].Endpoint.DNS == "" {
// Peers may have nil endpoints.
if m.peers[k].Endpoint == nil || m.peers[k].Endpoint.DNS == "" {
continue
}
if err := resolveEndpoint(m.peers[k].Endpoint); err != nil {