Skip to content

Commit 985e2a8

Browse files
authored
Fix nil panic if repo doesn't exist (#32501)
fix #32496
1 parent 9880c13 commit 985e2a8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

models/activities/action.go

+6
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
251251
// GetRepoUserName returns the name of the action repository owner.
252252
func (a *Action) GetRepoUserName(ctx context.Context) string {
253253
a.loadRepo(ctx)
254+
if a.Repo == nil {
255+
return "(non-existing-repo)"
256+
}
254257
return a.Repo.OwnerName
255258
}
256259

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

0 commit comments

Comments
 (0)