From 858b76e80c465d71448c71651441990f337720fe Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 6 Mar 2024 15:37:44 +0800 Subject: [PATCH] fix --- models/activities/action.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/models/activities/action.go b/models/activities/action.go index fcc97e387264d..36205eedd1f03 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -393,10 +393,14 @@ func (a *Action) GetCreate() time.Time { return a.CreatedUnix.AsTime() } -// GetIssueInfos returns a list of issues associated with -// the action. +// GetIssueInfos returns a list of associated information with the action. func (a *Action) GetIssueInfos() []string { - return strings.SplitN(a.Content, "|", 3) + // make sure it always returns 3 elements, because there are some access to the a[1] and a[2] without checking the length + ret := strings.SplitN(a.Content, "|", 3) + for len(ret) < 3 { + ret = append(ret, "") + } + return ret } // GetIssueTitle returns the title of first issue associated with the action.