aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorThibault Meyer <0xbaadf00d@users.noreply.github.com>2016-08-10 20:06:51 +0200
committer无闻 <u@gogs.io>2016-08-10 11:06:51 -0700
commit8ad92bb8a4d5aafd15781d35842b0b1273f9db26 (patch)
treee21b7ea14380cd85af00177f737b44178cef64fa /models
parentb85927e488c330aeda261ab9b90cd0f9c41d6b11 (diff)
downloadgitea-8ad92bb8a4d5aafd15781d35842b0b1273f9db26.tar.gz
gitea-8ad92bb8a4d5aafd15781d35842b0b1273f9db26.zip
Verify list len before use it with IN (#3423)
Diffstat (limited to 'models')
-rw-r--r--models/org.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/models/org.go b/models/org.go
index f4643f7887..706b188979 100644
--- a/models/org.go
+++ b/models/org.go
@@ -414,8 +414,11 @@ func RemoveOrgUser(orgID, userID int64) error {
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.