Explicitly check if there are Ids before trying to get items by a list of Ids
This commit is contained in:
parent
3999580fe6
commit
6de3d8b3a1
10 changed files with 61 additions and 18 deletions
|
|
@ -119,9 +119,11 @@ func (b *Bucket) ReadAll(s *xorm.Session, auth web.Auth, search string, page int
|
|||
|
||||
// Get all users
|
||||
users := make(map[int64]*user.User)
|
||||
err = s.In("id", userIDs).Find(&users)
|
||||
if err != nil {
|
||||
return
|
||||
if len(userIDs) > 0 {
|
||||
err = s.In("id", userIDs).Find(&users)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for _, bb := range buckets {
|
||||
|
|
|
|||
Reference in a new issue