Skip to content

Commit 9f05c76

Browse files
wxiaoguangearl-warren
authored andcommitted
Fix nil panic if repo doesn't exist (go-gitea#32501)
fix go-gitea#32496 (cherry picked from commit 985e2a8)
1 parent 6ac04b8 commit 9f05c76

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

models/activities/action.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
250250
// GetRepoUserName returns the name of the action repository owner.
251251
func (a *Action) GetRepoUserName(ctx context.Context) string {
252252
a.loadRepo(ctx)
253+
if a.Repo == nil {
254+
return "(non-existing-repo)"
255+
}
253256
return a.Repo.OwnerName
254257
}
255258

@@ -262,6 +265,9 @@ func (a *Action) ShortRepoUserName(ctx context.Context) string {
262265
// GetRepoName returns the name of the action repository.
263266
func (a *Action) GetRepoName(ctx context.Context) string {
264267
a.loadRepo(ctx)
268+
if a.Repo == nil {
269+
return "(non-existing-repo)"
270+
}
265271
return a.Repo.Name
266272
}
267273

0 commit comments

Comments
 (0)