From 59841fe6c4859b3d9a9629de502e402229864dfb Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 11 Jun 2018 08:51:03 +0800 Subject: [PATCH] fix delete comment bug --- models/issue_comment.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/issue_comment.go b/models/issue_comment.go index a829c80663dc..1c7c57dd0684 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -147,6 +147,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 {