Skip to content

Commit be41436

Browse files
committed
Ensure issue.Poster is loaded in mailIssueCommentToParticipants
Previous code could potentially dereference nil - this PR ensures that the poster is loaded before dereferencing it. Signed-off-by: Andrew Thornton <[email protected]>
1 parent 8917d66 commit be41436

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/issue_mail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, content
3939

4040
// In case the issue poster is not watching the repository and is active,
4141
// even if we have duplicated in watchers, can be safely filtered out.
42-
poster, err := getUserByID(e, issue.PosterID)
42+
err = issue.loadPoster(e)
4343
if err != nil {
4444
return fmt.Errorf("GetUserByID [%d]: %v", issue.PosterID, err)
4545
}
46-
if issue.PosterID != doer.ID && poster.IsActive && !poster.ProhibitLogin {
46+
if issue.PosterID != doer.ID && issue.Poster.IsActive && !issue.Poster.ProhibitLogin {
4747
participants = append(participants, issue.Poster)
4848
}
4949

0 commit comments

Comments
 (0)