Merge pull request #18 from LefsFlarey/issue/3675

Fix 500 error caused by deleted users on issues (#3675)
This commit is contained in:
Lunny Xiao 2016-11-09 15:14:18 +08:00 committed by GitHub
commit c511f1c6c3

View file

@ -94,12 +94,12 @@ func (issue *Issue) loadAttributes(e Engine) (err error) {
if issue.Poster == nil {
issue.Poster, err = getUserByID(e, issue.PosterID)
if err != nil {
if IsErrUserNotExist(err) {
issue.PosterID = -1
issue.Poster = NewGhostUser()
} else {
if !IsErrUserNotExist(err) {
return fmt.Errorf("getUserByID.(poster) [%d]: %v", issue.PosterID, err)
}
err = nil
return
}
}