mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 17:14:27 +00:00
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>
This commit is contained in:
parent
8917d66571
commit
036964b4a7
@ -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,
|
// 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.
|
// 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 {
|
if err != nil {
|
||||||
return fmt.Errorf("GetUserByID [%d]: %v", issue.PosterID, err)
|
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)
|
participants = append(participants, issue.Poster)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user