Skip to content

Commit f106404

Browse files
lunnylafriks
authored andcommitted
fix delete comment bug (go-gitea#4216) (go-gitea#4228)
1 parent 1ff480b commit f106404

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

models/issue_comment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func (c *Comment) AfterLoad(session *xorm.Session) {
132132

133133
// AfterDelete is invoked from XORM after the object is deleted.
134134
func (c *Comment) AfterDelete() {
135+
if c.ID <= 0 {
136+
return
137+
}
138+
135139
_, err := DeleteAttachmentsByComment(c.ID, true)
136140

137141
if err != nil {

0 commit comments

Comments
 (0)