Fix null pointer dereference error

This commit is contained in:
Alex 2020-04-05 14:32:49 +02:00
parent 88e435052c
commit 473336f0eb

View file

@ -607,7 +607,7 @@ func (mm *Mattermost) handlePost(channel_name string, post *model.Post, only_mes
} }
// Handle files // Handle files
if post.FileIds != nil && len(post.FileIds) > 0 { if post.Metadata != nil && post.Metadata.Files != nil {
msg_ev.Attachments = []SMediaObject{} msg_ev.Attachments = []SMediaObject{}
for _, file := range post.Metadata.Files { for _, file := range post.Metadata.Files {
media_object := &LazyBlobMediaObject{ media_object := &LazyBlobMediaObject{