summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-11-14 12:47:04 +0800
committerGitHub <noreply@github.com>2024-11-14 04:47:04 +0000
commitf79f8e13e37fc699800318a20cb2866a326c467e (patch)
tree0ba6c0ffa8d54b285441409f64f8c550b40dcf21
parenta4263d341c1d0cfb4fd17279d00e2b14f9ca35c1 (diff)
downloadgitea-f79f8e13e37fc699800318a20cb2866a326c467e.tar.gz
gitea-f79f8e13e37fc699800318a20cb2866a326c467e.zip
Fix nil panic if repo doesn't exist (#32501) (#32502)
Backport #32501 by wxiaoguang fix #32496 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--models/activities/action.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/activities/action.go b/models/activities/action.go
index a99df558cb..95132f9ced 100644
--- a/models/activities/action.go
+++ b/models/activities/action.go
@@ -248,6 +248,9 @@ func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
// GetRepoUserName returns the name of the action repository owner.
func (a *Action) GetRepoUserName(ctx context.Context) string {
a.loadRepo(ctx)
+ if a.Repo == nil {
+ return "(non-existing-repo)"
+ }
return a.Repo.OwnerName
}
@@ -260,6 +263,9 @@ func (a *Action) ShortRepoUserName(ctx context.Context) string {
// GetRepoName returns the name of the action repository.
func (a *Action) GetRepoName(ctx context.Context) string {
a.loadRepo(ctx)
+ if a.Repo == nil {
+ return "(non-existing-repo)"
+ }
return a.Repo.Name
}