mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-02 00:00:03 +02:00
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:
parent
15fbf509d3
commit
e57ac841de
7 changed files with 14 additions and 10 deletions
|
@ -765,8 +765,12 @@ func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commi
|
|||
|
||||
// GetCommentByID returns the comment by given ID.
|
||||
func GetCommentByID(id int64) (*Comment, error) {
|
||||
return getCommentByID(x, id)
|
||||
}
|
||||
|
||||
func getCommentByID(e Engine, id int64) (*Comment, error) {
|
||||
c := new(Comment)
|
||||
has, err := x.ID(id).Get(c)
|
||||
has, err := e.ID(id).Get(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue