diff options
author | zeripath <art27@cantab.net> | 2019-01-29 21:26:17 +0000 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-01-29 16:26:17 -0500 |
commit | 036964b4a7c131da03ed9bdbf1f6ea2a8fc26eed (patch) | |
tree | 55fb395d5e818c691b9a8cee1348d8c69b8a06aa | |
parent | 8917d66571a95f3da232a0c27bc1300210d10fde (diff) | |
download | gitea-036964b4a7c131da03ed9bdbf1f6ea2a8fc26eed.tar.gz gitea-036964b4a7c131da03ed9bdbf1f6ea2a8fc26eed.zip |
Ensure issue.Poster is loaded in mailIssueCommentToParticipants (#5891)
Previous code could potentially dereference nil - this PR ensures
that the poster is loaded before dereferencing it.
Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r-- | models/issue_mail.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/issue_mail.go b/models/issue_mail.go index 78dbd13def..b807e52281 100644 --- a/models/issue_mail.go +++ b/models/issue_mail.go @@ -39,11 +39,11 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, content // In case the issue poster is not watching the repository and is active, // even if we have duplicated in watchers, can be safely filtered out. - poster, err := getUserByID(e, issue.PosterID) + err = issue.loadPoster(e) if err != nil { return fmt.Errorf("GetUserByID [%d]: %v", issue.PosterID, err) } - if issue.PosterID != doer.ID && poster.IsActive && !poster.ProhibitLogin { + if issue.PosterID != doer.ID && issue.Poster.IsActive && !issue.Poster.ProhibitLogin { participants = append(participants, issue.Poster) } |