From 15015f280e47deb042cd6091a9df8f6da11ff159 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 5 Sep 2023 12:57:02 +0300 Subject: [PATCH] Fix panic if converted message has no parts --- portal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portal.go b/portal.go index 4fd0ff8..3df8f26 100644 --- a/portal.go +++ b/portal.go @@ -1025,7 +1025,7 @@ func (portal *Portal) convertGoogleMessage(ctx context.Context, source *User, ev if portal.bridge.Config.Bridge.CaptionInMessage { 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 if extra == nil { extra = make(map[string]any)