From e123d18ecc49d8f7a90673e97bb3f2c243a0a8ef Mon Sep 17 00:00:00 2001 From: lintanghui Date: Wed, 17 Jul 2019 09:34:50 +0800 Subject: [PATCH] check nil instance --- pkg/naming/discovery/discovery.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/naming/discovery/discovery.go b/pkg/naming/discovery/discovery.go index f47fd9584..9197362b5 100644 --- a/pkg/naming/discovery/discovery.go +++ b/pkg/naming/discovery/discovery.go @@ -609,6 +609,10 @@ func (d *Discovery) polls(ctx context.Context) (apps map[string]*naming.Instance func (d *Discovery) broadcast(apps map[string]*naming.InstancesInfo) { for appID, v := range apps { var count int + // v maybe nil in old version(less than v1.1) discovery,check incase of panic + if v==nil { + continue + } for zone, ins := range v.Instances { if len(ins) == 0 { delete(v.Instances, zone)