Skip to content

Commit

Permalink
Merge pull request #559 from Icinga/segv
Browse files Browse the repository at this point in the history
Heartbeat#sendEvent(m): nil-check m before dereferencing it
  • Loading branch information
julianbrost committed Jun 5, 2023
2 parents 049a62b + 5a79a72 commit 78fa223
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/icingaredis/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ func (h *Heartbeat) sendEvent(m *HeartbeatMessage) {
select {
case old := <-h.events:
if old != nil {
h.logger.Debugw("Previous heartbeat not read from channel",
zap.Time("previous", old.received),
zap.Time("current", m.received))
kv := []any{zap.Time("previous", old.received)}
if m != nil {
kv = append(kv, zap.Time("current", m.received))
}

h.logger.Debugw("Previous heartbeat not read from channel", kv...)
} else {
h.logger.Debug("Previous heartbeat loss event not read from channel")
}
Expand Down

0 comments on commit 78fa223

Please sign in to comment.