From 49eb8316637616e5bac6b24a30a7df764d6bdc9b Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 30 Jul 2024 11:56:25 +0900 Subject: [PATCH] Fix Null Pointer error for CommitStatusesHideActionsURL (#31731) Fix https://github.com/go-gitea/gitea/pull/30156#discussion_r1695247028 Forgot fixing it in #31719 (cherry picked from commit 0a11bce87f07233d5f02554b8f3b4a2aabd37769) --- models/git/commit_status.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/git/commit_status.go b/models/git/commit_status.go index 422cf0b4ee..53d1ddc8c3 100644 --- a/models/git/commit_status.go +++ b/models/git/commit_status.go @@ -506,6 +506,10 @@ func ConvertFromGitCommit(ctx context.Context, commits []*git.Commit, repo *repo func CommitStatusesHideActionsURL(ctx context.Context, statuses []*CommitStatus) { idToRepos := make(map[int64]*repo_model.Repository) for _, status := range statuses { + if status == nil { + continue + } + if status.Repo == nil { status.Repo = idToRepos[status.RepoID] }