Skip to content

Commit

Permalink
Fix nil panic if repo doesn't exist (go-gitea#32501)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored Nov 14, 2024
1 parent 9880c13 commit 985e2a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions models/activities/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,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
}

Expand All @@ -263,6 +266,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
}

Expand Down

0 comments on commit 985e2a8

Please sign in to comment.