Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent nil dereference in mailIssueCommentToParticipants (#5891, #5895) #5894

Merged

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Jan 29, 2019

The previous code could potentially dereference nil - this PR ensures
that the poster and the repo are loaded before dereferencing them.

#5891

Signed-off-by: Andrew Thornton [email protected]

…itea#5891)

Previous code could potentially dereference nil - this PR ensures
that the poster is loaded before dereferencing it.

Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath changed the title Ensure issue.Poster is loaded in mailIssueCommentToParticipants (Backport #5891) Prevent nil dereference in mailIssueCommentToParticipants (Backport #5891) Jan 29, 2019
@@ -88,6 +88,10 @@ func mailIssueCommentToParticipants(e Engine, issue *Issue, doer *User, content
names = append(names, participants[i].Name)
}

if err := issue.loadRepo(e); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes are not in the original PR #5891

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup as per: #5891 (comment)

I noticed another nil dereference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to remove and do another PR if preferred.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, I'd prefer it in another PR since backports are basically cherrypicked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only trouble is that the PR doesn't then completely fix the bug...

@techknowlogick Should we keep the repo fix in this PR or make another with it separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adelowo I think if we get #5895 in we can make this a squashed backport for both those.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, preferably two PRs for the reasons @adelowo listed above. However in this case I think we can keep it as one PR.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 29, 2019
@techknowlogick techknowlogick changed the title Prevent nil dereference in mailIssueCommentToParticipants (Backport #5891) Prevent nil dereference in mailIssueCommentToParticipants (#5891) Jan 29, 2019
@techknowlogick techknowlogick added this to the 1.7.1 milestone Jan 29, 2019
@zeripath zeripath changed the title Prevent nil dereference in mailIssueCommentToParticipants (#5891) Prevent nil dereference in mailIssueCommentToParticipants (#5891, #5895) Jan 29, 2019
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 29, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 29, 2019
@zeripath zeripath merged commit 0190d3c into go-gitea:release/v1.7 Jan 29, 2019
@zeripath zeripath deleted the backport-5891-to-release-v1.7 branch January 29, 2019 23:55
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants