aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-08-21 08:53:14 +0100
committerGitHub <noreply@github.com>2020-08-21 10:53:14 +0300
commit9c9c3348bb5ec3daacb43ab31a9cdf3f2872e46b (patch)
treec544d21e48429c704d8d80b20d9016d49bffb29d /services
parentc6943cca52823a679dbff615001541a8bce18c52 (diff)
downloadgitea-9c9c3348bb5ec3daacb43ab31a9cdf3f2872e46b.tar.gz
gitea-9c9c3348bb5ec3daacb43ab31a9cdf3f2872e46b.zip
Prevent NPE on commenting on lines with invalidated comments (with migration) (#12549)
* Prevent NPE on commenting on lines with invalidated comments Only check for a review if we are replying to a previous review. Prevent the NPE in #12239 by assuming that a comment without a Review is non-pending. Fix #12239 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add hack around to show the broken comments Signed-off-by: Andrew Thornton <art27@cantab.net> * Add migration and remove template hacks Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'services')
-rw-r--r--services/pull/review.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/pull/review.go b/services/pull/review.go
index 25e0ca858a..5a77a4da16 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -29,7 +29,7 @@ func CreateCodeComment(doer *models.User, gitRepo *git.Repository, issue *models
// - Comments that are part of a review
// - Comments that reply to an existing review
- if !isReview {
+ if !isReview && replyReviewID != 0 {
// It's not part of a review; maybe a reply to a review comment or a single comment.
// Check if there are reviews for that line already; if there are, this is a reply
if existsReview, err = models.ReviewExists(issue, treePath, line); err != nil {