summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-04-20 05:04:08 +0200
committerGitHub <noreply@github.com>2020-04-20 04:04:08 +0100
commit77171abcada24d1cb786cd33c7c83b21e00b4350 (patch)
tree47a2199fa61350b8a3144f3d83330cc1c7610bc0
parente37e217602989afd9f5700827a0b10377f793397 (diff)
downloadgitea-77171abcada24d1cb786cd33c7c83b21e00b4350.tar.gz
gitea-77171abcada24d1cb786cd33c7c83b21e00b4350.zip
Prevent xorm nil insert in Review.Comments (#11150)
-rw-r--r--models/review.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/models/review.go b/models/review.go
index 7f23777c3e..bbd4983fc2 100644
--- a/models/review.go
+++ b/models/review.go
@@ -457,8 +457,10 @@ func InsertReviews(reviews []*Review) error {
c.ReviewID = review.ID
}
- if _, err := sess.NoAutoTime().Insert(review.Comments); err != nil {
- return err
+ if len(review.Comments) > 0 {
+ if _, err := sess.NoAutoTime().Insert(review.Comments); err != nil {
+ return err
+ }
}
}