From 714ac6d6fd31fd84f1a85f76f0a3bf6e5a35f037 Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Tue, 1 Sep 2020 14:28:21 +0800 Subject: [PATCH] master: fix panic when etcd member not started (#970) Co-authored-by: lance6716 --- 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{