From 514033f14c16f0634ffb36584b866c153943a692 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 19 Apr 2018 10:21:33 -0400 Subject: Fix panics caused by race in notification code (#8652) --- app/notification.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/notification.go') diff --git a/app/notification.go b/app/notification.go index d69bb4e2e..d1f6225b3 100644 --- a/app/notification.go +++ b/app/notification.go @@ -179,6 +179,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod if a.Config().EmailSettings.SendEmailNotifications { for _, id := range mentionedUsersList { + if profileMap[id] == nil { + continue + } + userAllowsEmails := profileMap[id].NotifyProps[model.EMAIL_NOTIFY_PROP] != "false" if channelEmail, ok := channelMemberNotifyPropsMap[id][model.EMAIL_NOTIFY_PROP]; ok { if channelEmail != model.CHANNEL_NOTIFY_DEFAULT { @@ -279,6 +283,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod if sendPushNotifications { for _, id := range mentionedUsersList { + if profileMap[id] == nil { + continue + } + var status *model.Status var err *model.AppError if status, err = a.GetStatus(id); err != nil { @@ -291,6 +299,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod } for _, id := range allActivityPushUserIds { + if profileMap[id] == nil { + continue + } + if _, ok := mentionedUserIds[id]; !ok { var status *model.Status var err *model.AppError -- cgit v1.2.3-1-g7c22