aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/juick/server/UserQueries.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java
index c9f804cf..817ae5d3 100644
--- a/src/main/java/com/juick/server/UserQueries.java
+++ b/src/main/java/com/juick/server/UserQueries.java
@@ -171,11 +171,19 @@ public class UserQueries {
}
public static int getUIDbyName(JdbcTemplate sql, String uname) {
- return sql.queryForObject("SELECT id FROM users WHERE nick=?", Integer.class, uname);
+ try {
+ return sql.queryForObject("SELECT id FROM users WHERE nick=?", Integer.class, uname);
+ } catch (EmptyResultDataAccessException e) {
+ return 0;
+ }
}
public static int getUIDbyHash(JdbcTemplate sql, String hash) {
- return sql.queryForObject("SELECT user_id FROM logins WHERE hash=?", Integer.class, hash);
+ try {
+ return sql.queryForObject("SELECT user_id FROM logins WHERE hash=?", Integer.class, hash);
+ } catch (EmptyResultDataAccessException e) {
+ return 0;
+ }
}
public static com.juick.User getUserByHash(JdbcTemplate sql, String hash) {