aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/juick/server/UserQueries.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java
index 21373b7d..948b42d4 100644
--- a/src/main/java/com/juick/server/UserQueries.java
+++ b/src/main/java/com/juick/server/UserQueries.java
@@ -293,10 +293,13 @@ public class UserQueries {
}
public static boolean isInBLAny(JdbcTemplate sql, int uid, int uid2) {
- List<Integer> res = sql.queryForList("SELECT 1 FROM bl_users "
- + "WHERE (user_id=? AND bl_user_id=?) "
- + "OR (user_id=? AND bl_user_id=?)", Integer.class, new Object[] {uid, uid2, uid2, uid});
- return res.get(0) == 1;
+ try {
+ return sql.queryForObject("SELECT 1 FROM bl_users "
+ + "WHERE (user_id=? AND bl_user_id=?) "
+ + "OR (user_id=? AND bl_user_id=?)", new Object[]{uid, uid2, uid2, uid}, Integer.class) == 1;
+ } catch (EmptyResultDataAccessException e) {
+ return false;
+ }
}
public static List<Integer> checkBL(Connection sql, int visitor, List<Integer> uids) {