connector/tomatrix: fix nil handling
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -35,12 +35,12 @@ type ttlable interface {
|
|||||||
|
|
||||||
func mediaHashID(ctx context.Context, m tg.MessageMediaClass) []byte {
|
func mediaHashID(ctx context.Context, m tg.MessageMediaClass) []byte {
|
||||||
switch media := m.(type) {
|
switch media := m.(type) {
|
||||||
|
case nil:
|
||||||
|
return nil
|
||||||
case *tg.MessageMediaPhoto:
|
case *tg.MessageMediaPhoto:
|
||||||
return binary.BigEndian.AppendUint64(nil, uint64(media.Photo.GetID()))
|
return binary.BigEndian.AppendUint64(nil, uint64(media.Photo.GetID()))
|
||||||
case *tg.MessageMediaDocument:
|
case *tg.MessageMediaDocument:
|
||||||
return binary.BigEndian.AppendUint64(nil, uint64(media.Document.GetID()))
|
return binary.BigEndian.AppendUint64(nil, uint64(media.Document.GetID()))
|
||||||
case nil:
|
|
||||||
return nil
|
|
||||||
default:
|
default:
|
||||||
zerolog.Ctx(ctx).Error().Type("media_type", m).Msg("Attempted to get hash for unsupported media type ID")
|
zerolog.Ctx(ctx).Error().Type("media_type", m).Msg("Attempted to get hash for unsupported media type ID")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user