From 70ad8abdcdb8f2fd3203a4962f5fc4041fa97100 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 2 Feb 2018 14:46:49 -0500 Subject: Fix panic when invalid types used in post props (#8191) --- app/notification.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/notification.go') diff --git a/app/notification.go b/app/notification.go index 7223fb3aa..19f7894c5 100644 --- a/app/notification.go +++ b/app/notification.go @@ -584,16 +584,16 @@ func (a *App) sendPushNotification(post *model.Post, user *model.User, channel * msg.ChannelName = channel.Name msg.SenderId = post.UserId - if ou, ok := post.Props["override_username"]; ok && ou != nil { - msg.OverrideUsername = ou.(string) + if ou, ok := post.Props["override_username"].(string); ok { + msg.OverrideUsername = ou } - if oi, ok := post.Props["override_icon_url"]; ok && oi != nil { - msg.OverrideIconUrl = oi.(string) + if oi, ok := post.Props["override_icon_url"].(string); ok { + msg.OverrideIconUrl = oi } - if fw, ok := post.Props["from_webhook"]; ok && fw != nil { - msg.FromWebhook = fw.(string) + if fw, ok := post.Props["from_webhook"].(string); ok { + msg.FromWebhook = fw } if *a.Config().EmailSettings.PushNotificationContents == model.FULL_NOTIFICATION { -- cgit v1.2.3-1-g7c22