From c00418e74cd1bbcff11f413c182cd72003b0244f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 29 Sep 2022 20:35:57 +0800 Subject: [PATCH] Print pull dont crash if it has TeamReviewRequests (#517) partial backport of #515 Reviewed-on: https://gitea.com/gitea/tea/pulls/517 Reviewed-by: Norwin --- modules/print/pull.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/print/pull.go b/modules/print/pull.go index d3f11a3..3ec24aa 100644 --- a/modules/print/pull.go +++ b/modules/print/pull.go @@ -99,8 +99,11 @@ func formatReviews(reviews []*gitea.PullReview) string { case gitea.ReviewStateApproved, gitea.ReviewStateRequestChanges, gitea.ReviewStateRequestReview: - if r, ok := reviewByUser[review.Reviewer.ID]; !ok || review.Submitted.After(r.Submitted) { - reviewByUser[review.Reviewer.ID] = review + // only user reviews are supported no team review requests + if review.Reviewer != nil { + if r, ok := reviewByUser[review.Reviewer.ID]; !ok || review.Submitted.After(r.Submitted) { + reviewByUser[review.Reviewer.ID] = review + } } } }