From 940e30bcd4d82c00f2ad90b597fb8d868e232c9d Mon Sep 17 00:00:00 2001 From: Dingjun Date: Wed, 1 Aug 2018 21:34:57 +0800 Subject: [PATCH] fix panic issue on update avatar email (#4580) (#4590) fix #4580 back port PR for release/v1.5, refer to #4581 --- routers/user/setting/profile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go index 22511ab89144d..6a2eacd09de85 100644 --- a/routers/user/setting/profile.go +++ b/routers/user/setting/profile.go @@ -119,7 +119,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *mo ctxUser.AvatarEmail = form.Gravatar } - if form.Avatar.Filename != "" { + if form.Avatar != nil && form.Avatar.Filename != "" { fr, err := form.Avatar.Open() if err != nil { return fmt.Errorf("Avatar.Open: %v", err)