Skip to content

Commit

Permalink
Merge pull request #11938 from tedyu/mk-v2-evt-nil
Browse files Browse the repository at this point in the history
Check events against nil
  • Loading branch information
gyuho authored May 22, 2020
2 parents 4c9571d + df57a68 commit e007d4f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions etcdserver/api/v2v3/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e007d4f

Please sign in to comment.