From 699523f81622bd03e8a3fd930d1709ce936e48d5 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Fri, 11 Oct 2024 16:23:18 +0800 Subject: [PATCH] fix nil pointer error. --- internal/conversation_msg/api.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/conversation_msg/api.go b/internal/conversation_msg/api.go index ee4d78c2d..7b7ce45f1 100644 --- a/internal/conversation_msg/api.go +++ b/internal/conversation_msg/api.go @@ -328,7 +328,10 @@ func (c *Conversation) GetConversationIDBySessionType(_ context.Context, sourceI func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct, recvID, groupID string, p *sdkws.OfflinePushInfo, isOnlineOnly bool) (*sdk_struct.MsgStruct, error) { // Message is created by URL - if s.FileElem.SourceURL != "" || s.SoundElem.SourceURL != "" || s.VideoElem.VideoURL != "" || (s.PictureElem.SourcePicture.Url != "" || s.PictureElem.BigPicture.Url != "" || s.PictureElem.SnapshotPicture.Url != "") { + if (s.FileElem != nil && s.FileElem.SourceURL != "") || + (s.SoundElem != nil && s.SoundElem.SourceURL != "") || + (s.VideoElem != nil && s.VideoElem.VideoURL != "") || + (s.PictureElem != nil && (s.PictureElem.SourcePicture.Url != "" || s.PictureElem.BigPicture.Url != "" || s.PictureElem.SnapshotPicture.Url != "")) { return c.sendMessageNotOss(ctx, s, recvID, groupID, p, isOnlineOnly) }