From 68b908d92a5e6615b8a423d406951c5fc2d528ae Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Thu, 9 Feb 2023 15:53:14 -0600 Subject: [PATCH] Load issue before accessing index in merge message (#22822) (#22830) Backport #22822 --------- Signed-off-by: jolheiser --- services/pull/merge.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/pull/merge.go b/services/pull/merge.go index ddfac5a21..2ae23b344 100644 --- a/services/pull/merge.go +++ b/services/pull/merge.go @@ -99,6 +99,9 @@ func GetDefaultMergeMessage(baseGitRepo *git.Repository, pr *issues_model.PullRe } for _, ref := range refs { if ref.RefAction == references.XRefActionCloses { + if err := ref.LoadIssue(); err != nil { + return "", err + } closeIssueIndexes = append(closeIssueIndexes, fmt.Sprintf("%s %s%d", closeWord, issueReference, ref.Issue.Index)) } }