From 77171abcada24d1cb786cd33c7c83b21e00b4350 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 20 Apr 2020 05:04:08 +0200 Subject: [PATCH] Prevent xorm nil insert in Review.Comments (#11150) --- models/review.go | 6 ++++-- 1 file 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 + } } }