Guard in all key consumers

This commit is contained in:
Neil Alexander 2021-11-16 09:27:49 +00:00
parent ddbef7c3ff
commit a9e715b5c5
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 15 additions and 6 deletions

View file

@ -109,6 +109,11 @@ func (s *OutputKeyChangeEventConsumer) onMessage(msg *sarama.ConsumerMessage) er
logrus.WithError(err).Errorf("failed to read device message from key change topic")
return nil
}
if m.DeviceKeys == nil && m.OutputCrossSigningKeyUpdate == nil {
// This probably shouldn't happen but stops us from panicking if we come
// across an update that doesn't satisfy either types.
return nil
}
switch m.Type {
case api.TypeCrossSigningUpdate:
return s.onCrossSigningMessage(m, msg.Offset, msg.Partition)