mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-17 15:32:43 +00:00
Fix intermittent panic in notify issue change content (#23019)
Ensure that issue pullrequests are loaded before trying to set the self-reference. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <leon@kske.dev> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
97aacc3ea1
commit
35d2fa744a
2 changed files with 12 additions and 9 deletions
|
@ -251,13 +251,15 @@ func (issue *Issue) LoadPoster(ctx context.Context) (err error) {
|
|||
|
||||
// LoadPullRequest loads pull request info
|
||||
func (issue *Issue) LoadPullRequest(ctx context.Context) (err error) {
|
||||
if issue.IsPull && issue.PullRequest == nil {
|
||||
issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID)
|
||||
if err != nil {
|
||||
if IsErrPullRequestNotExist(err) {
|
||||
return err
|
||||
if issue.IsPull {
|
||||
if issue.PullRequest == nil {
|
||||
issue.PullRequest, err = GetPullRequestByIssueID(ctx, issue.ID)
|
||||
if err != nil {
|
||||
if IsErrPullRequestNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err)
|
||||
}
|
||||
return fmt.Errorf("getPullRequestByIssueID [%d]: %w", issue.ID, err)
|
||||
}
|
||||
issue.PullRequest.Issue = issue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue