Skip to content

Commit

Permalink
Fix nil panic if repo doesn't exist (#32501) (#32502)
Browse files Browse the repository at this point in the history
Backport #32501 by wxiaoguang

fix  #32496

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
  • Loading branch information
GiteaBot and wxiaoguang authored Nov 14, 2024
1 parent a4263d3 commit f79f8e1
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 @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit f79f8e1

Please sign in to comment.