From 170c1c5152175d3b308392dafce54b2df5e0f37b Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 4 Aug 2024 09:30:36 +0200 Subject: [PATCH] Hide the "Details" link of commit status when the user cannot access actions (followup) commit.Status may be nil --- routers/web/repo/commit.go | 3 +++ routers/web/repo/issue.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 3da8b1506c..ec9e49eb9c 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -463,6 +463,9 @@ func processGitCommits(ctx *context.Context, gitCommits []*git.Commit) []*git_mo commits := git_model.ConvertFromGitCommit(ctx, gitCommits, ctx.Repo.Repository) if !ctx.Repo.CanRead(unit_model.TypeActions) { for _, commit := range commits { + if commit.Status == nil { + continue + } commit.Status.HideActionsURL(ctx) git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index b48b078736..5a0dcd830f 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1784,6 +1784,9 @@ func ViewIssue(ctx *context.Context) { } if !ctx.Repo.CanRead(unit.TypeActions) { for _, commit := range comment.Commits { + if commit.Status == nil { + continue + } commit.Status.HideActionsURL(ctx) git_model.CommitStatusesHideActionsURL(ctx, commit.Statuses) }