Fix panic if converted message has no parts

This commit is contained in:
Tulir Asokan 2023-09-05 12:57:02 +03:00
parent 25d53248e2
commit 15015f280e

View file

@ -1025,7 +1025,7 @@ func (portal *Portal) convertGoogleMessage(ctx context.Context, source *User, ev
if portal.bridge.Config.Bridge.CaptionInMessage { if portal.bridge.Config.Bridge.CaptionInMessage {
cm.MergeCaption() cm.MergeCaption()
} }
if raw != nil && base64.StdEncoding.EncodedLen(len(raw)) < 8192 { if raw != nil && base64.StdEncoding.EncodedLen(len(raw)) < 8192 && len(cm.Parts) > 0 {
extra := cm.Parts[0].Extra extra := cm.Parts[0].Extra
if extra == nil { if extra == nil {
extra = make(map[string]any) extra = make(map[string]any)