aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r--src/main/java/com/juick/server/UserQueries.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java
index 3a0e03ba..ca562765 100644
--- a/src/main/java/com/juick/server/UserQueries.java
+++ b/src/main/java/com/juick/server/UserQueries.java
@@ -187,11 +187,15 @@ public class UserQueries {
}
public static com.juick.User getUserByHash(JdbcTemplate sql, String hash) {
- User user = sql.queryForObject("SELECT logins.user_id,users.nick, users.banned FROM logins " +
- "INNER JOIN users ON logins.user_id=users.id WHERE logins.hash=?",
- new UserMapper(), hash);
- user.setAuthHash(hash);
- return user;
+ try {
+ User user = sql.queryForObject("SELECT logins.user_id,users.nick, users.banned FROM logins " +
+ "INNER JOIN users ON logins.user_id=users.id WHERE logins.hash=?",
+ new UserMapper(), hash);
+ user.setAuthHash(hash);
+ return user;
+ } catch (EmptyResultDataAccessException e) {
+ return new User();
+ }
}
public static String getHashByUID(JdbcTemplate sql, int uid) {