diff options
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/server/UserQueries.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java index ca562765..db380d7a 100644 --- a/src/main/java/com/juick/server/UserQueries.java +++ b/src/main/java/com/juick/server/UserQueries.java @@ -117,13 +117,19 @@ public class UserQueries { } public static List<User> getUsersByName(JdbcTemplate sql, List<String> unames) { - return sql.query("SELECT id,nick,banned FROM users WHERE nick IN (" + Utils.convertArrayString2String(unames) + ")", - new UserMapper()); + if (!unames.isEmpty()) { + return sql.query("SELECT id,nick,banned FROM users WHERE nick IN (" + Utils.convertArrayString2String(unames) + ")", + new UserMapper()); + } + return Collections.emptyList(); } public static List<User> getUsersByID(JdbcTemplate sql, List<Integer> uids) { - return sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + Utils.convertArrayInt2String(uids) + ")", - new UserMapper()); + if (!uids.isEmpty()) { + return sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + Utils.convertArrayInt2String(uids) + ")", + new UserMapper()); + } + return Collections.emptyList(); } public static boolean fillUsersByID(JdbcTemplate sql, List<User> users) { |