From 6d845c7d0ddf662c8dc476fee7cce9ea9b4374d8 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 24 Jul 2015 14:17:23 -0700 Subject: [PATCH] Adds explicit check for empty node in source parameter. --- consul/rtt.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/consul/rtt.go b/consul/rtt.go index d3ed5d7cf5..b74e65b5bf 100644 --- a/consul/rtt.go +++ b/consul/rtt.go @@ -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