mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
[GITEA] Fix NPE in ToPullReviewList
- Add condition to ensure doer isn't nil when using it. - Added unit test. - Resolves #2055 (cherry picked from commit8f1a74fb29
) (cherry picked from commit60ac881776
) (cherry picked from commit5fdc461ac5
) (cherry picked from commit70623e8da1
) (cherry picked from commit1d5153aaf6
) (cherry picked from commit3927f0c8b2
)
This commit is contained in:
parent
f3b298133e
commit
1bae2430c0
2 changed files with 29 additions and 1 deletions
|
@ -66,7 +66,7 @@ func ToPullReviewList(ctx context.Context, rl []*issues_model.Review, doer *user
|
|||
result := make([]*api.PullReview, 0, len(rl))
|
||||
for i := range rl {
|
||||
// show pending reviews only for the user who created them
|
||||
if rl[i].Type == issues_model.ReviewTypePending && !(doer.IsAdmin || doer.ID == rl[i].ReviewerID) {
|
||||
if rl[i].Type == issues_model.ReviewTypePending && (doer == nil || !(doer.IsAdmin || doer.ID == rl[i].ReviewerID)) {
|
||||
continue
|
||||
}
|
||||
r, err := ToPullReview(ctx, rl[i], doer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue