1
0
Fork 0
forked from forgejo/forgejo

Fix potential bugs (#10513)

* use e if it is an option
* potential nil so check err first
* check err first
* m == nil already checked
This commit is contained in:
6543 2020-02-28 00:10:27 +01:00 committed by GitHub
parent 15fbf509d3
commit e57ac841de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 10 deletions

View file

@ -199,7 +199,7 @@ func GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error) {
func getAttachmentsByCommentID(e Engine, commentID int64) ([]*Attachment, error) {
attachments := make([]*Attachment, 0, 10)
return attachments, x.Where("comment_id=?", commentID).Find(&attachments)
return attachments, e.Where("comment_id=?", commentID).Find(&attachments)
}
// getAttachmentByReleaseIDFileName return a file based on the the following infos: