Fix loadRepository error when access user dashboard (#31719)

(cherry picked from commit 7b388630ecb4537f9bb04e55cbb10eb7cf83b9c5)
This commit is contained in:
yp05327 2024-07-29 15:51:02 +09:00 committed by Earl Warren
parent 7850fa30a5
commit 2be49a3745
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -181,6 +181,10 @@ func (status *CommitStatus) LocaleString(lang translation.Locale) string {
// HideActionsURL set `TargetURL` to an empty string if the status comes from Gitea Actions
func (status *CommitStatus) HideActionsURL(ctx context.Context) {
if status.RepoID == 0 {
return
}
if status.Repo == nil {
if err := status.loadRepository(ctx); err != nil {
log.Error("loadRepository: %v", err)