From 78e553e72643b358b33cd94fd42837ff64241b78 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Tue, 1 Sep 2020 11:20:34 +0800 Subject: [PATCH] master: fix panic when etcd member not started --- dm/master/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dm/master/server.go b/dm/master/server.go index 99ef3b1ad5..6a6cf8b7c7 100644 --- a/dm/master/server.go +++ b/dm/master/server.go @@ -1867,9 +1867,13 @@ func (s *Server) listMemberMaster(ctx context.Context, names []string) (*pb.Memb } alive := true - _, err := client.Get(etcdMember.ClientURLs[0] + "/health") - if err != nil { + if len(etcdMember.ClientURLs) == 0 { alive = false + } else { + _, err := client.Get(etcdMember.ClientURLs[0] + "/health") + if err != nil { + alive = false + } } masters = append(masters, &pb.MasterInfo{