From 8ad92bb8a4d5aafd15781d35842b0b1273f9db26 Mon Sep 17 00:00:00 2001 From: Thibault Meyer <0xbaadf00d@users.noreply.github.com> Date: Wed, 10 Aug 2016 20:06:51 +0200 Subject: [PATCH] Verify list len before use it with IN (#3423) --- models/org.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/org.go b/models/org.go index f4643f788..706b18897 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.