aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-06-28 10:36:04 +0300
committerGravatar Vitaly Takmazov2016-06-28 10:36:04 +0300
commit87da42e3385e368f05d88ff125a78605a18f9cc3 (patch)
tree068737cd07a81de95b2691ca808fa5bfe18ce71a /src/main/java/com/juick
parentbbc05316ebbbd8da30ac12135791e110cacbebd5 (diff)
fix getuserbyhash
Diffstat (limited to 'src/main/java/com/juick')
-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) {