Browse Source

Verify list len before use it with IN (#3423)

tags/v1.21.12.1
Thibault Meyer 无闻 9 years ago
parent
commit
8ad92bb8a4
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      models/org.go

+ 5
- 2
models/org.go View File

@@ -414,8 +414,11 @@ func RemoveOrgUser(orgID, userID int64) error {
return err return err
} }
} }
if _, err = sess.Where("user_id = ?", user.ID).In("repo_id", repoIDs).Delete(new(Access)); err != nil {
return err

if len(repoIDs) > 0 {
if _, err = sess.Where("user_id = ?", user.ID).In("repo_id", repoIDs).Delete(new(Access)); err != nil {
return err
}
} }


// Delete member in his/her teams. // Delete member in his/her teams.


Loading…
Cancel
Save