Skip to content

Commit f79f8e1

Browse files
GiteaBotwxiaoguang
andauthored
Fix nil panic if repo doesn't exist (#32501) (#32502)
Backport #32501 by wxiaoguang fix #32496 Co-authored-by: wxiaoguang <[email protected]>
1 parent a4263d3 commit f79f8e1

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
@@ -248,6 +248,9 @@ func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
248248
// GetRepoUserName returns the name of the action repository owner.
249249
func (a *Action) GetRepoUserName(ctx context.Context) string {
250250
a.loadRepo(ctx)
251+
if a.Repo == nil {
252+
return "(non-existing-repo)"
253+
}
251254
return a.Repo.OwnerName
252255
}
253256

@@ -260,6 +263,9 @@ func (a *Action) ShortRepoUserName(ctx context.Context) string {
260263
// GetRepoName returns the name of the action repository.
261264
func (a *Action) GetRepoName(ctx context.Context) string {
262265
a.loadRepo(ctx)
266+
if a.Repo == nil {
267+
return "(non-existing-repo)"
268+
}
263269
return a.Repo.Name
264270
}
265271

0 commit comments

Comments
 (0)