Merge pull request #11938 from tedyu/mk-v2-evt-nil

Check events against nil
This commit is contained in:
Gyuho Lee 2020-05-22 13:38:53 -07:00 committed by GitHub
commit e007d4f58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,13 +97,15 @@ func (s *v2v3Store) mkV2Events(wr clientv3.WatchResponse) (evs []*v2store.Event)
key = ev
}
}
v2ev := &v2store.Event{
Action: string(act.Kv.Value),
Node: s.mkV2Node(key.Kv),
PrevNode: s.mkV2Node(key.PrevKv),
EtcdIndex: mkV2Rev(wr.Header.Revision),
if act != nil && act.Kv != nil && key != nil {
v2ev := &v2store.Event{
Action: string(act.Kv.Value),
Node: s.mkV2Node(key.Kv),
PrevNode: s.mkV2Node(key.PrevKv),
EtcdIndex: mkV2Rev(wr.Header.Revision),
}
evs = append(evs, v2ev)
}
evs = append(evs, v2ev)
}
return evs
}