From 61bad89e514c150e6fcf5e319330ba4798bcb604 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 31 Dec 2013 18:16:09 -0800 Subject: [PATCH] Fix indexing error when getting nodes --- consul/catalog_endpoint.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consul/catalog_endpoint.go b/consul/catalog_endpoint.go index 5b5a47539d..96100b1efb 100644 --- a/consul/catalog_endpoint.go +++ b/consul/catalog_endpoint.go @@ -76,8 +76,8 @@ func (c *Catalog) ListNodes(dc string, reply *structs.Nodes) error { // Format the response nodes := structs.Nodes(make([]structs.Node, len(rawNodes)/2)) - for i := 0; i < len(rawNodes); i += 2 { - nodes[i] = structs.Node{rawNodes[i], rawNodes[i+1]} + for i := 0; i < len(nodes); i++ { + nodes[i] = structs.Node{rawNodes[i*2], rawNodes[i*2+1]} } *reply = nodes