Adds explicit check for empty node in source parameter.

This commit is contained in:
James Phillips 2015-07-24 14:17:23 -07:00
parent 78b2c2d7ac
commit 6d845c7d0d
1 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,11 @@ func (s *Server) sortNodesByDistanceFrom(source structs.QuerySource, subj interf
return nil
}
// We can't sort if there's no source node.
if source.Node == "" {
return nil
}
// We can't compare coordinates across DCs.
if source.Datacenter != s.config.Datacenter {
return nil