From f10640433f80bb7ba48cc8d60f4f2cfa8f22b093 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 12 Jun 2018 18:39:37 +0800 Subject: [PATCH] fix delete comment bug (#4216) (#4228) --- models/issue_comment.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/issue_comment.go b/models/issue_comment.go index ea83c356e..442cc301f 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -132,6 +132,10 @@ func (c *Comment) AfterLoad(session *xorm.Session) { // AfterDelete is invoked from XORM after the object is deleted. func (c *Comment) AfterDelete() { + if c.ID <= 0 { + return + } + _, err := DeleteAttachmentsByComment(c.ID, true) if err != nil {