diff options
author | Vitaly Takmazov | 2016-06-27 13:29:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-06-27 13:29:51 +0300 |
commit | 4683d6b828d2bf6d56a53205c785f7982ce1be11 (patch) | |
tree | e795c09347edf170169df02fb579f416dcad0366 /src/main/java/com/juick/server/MessagesQueries.java | |
parent | 6362eab34390b187944c7e3c12eb444e2fb2c455 (diff) |
fixes
Diffstat (limited to 'src/main/java/com/juick/server/MessagesQueries.java')
-rw-r--r-- | src/main/java/com/juick/server/MessagesQueries.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java index bfd0d71a..77998d16 100644 --- a/src/main/java/com/juick/server/MessagesQueries.java +++ b/src/main/java/com/juick/server/MessagesQueries.java @@ -268,15 +268,19 @@ public class MessagesQueries { } public static User getMessageAuthor(JdbcTemplate sql, int mid) { - return sql.queryForObject("SELECT messages.user_id,users.nick " - + "FROM messages INNER JOIN users " - + "ON messages.user_id=users.id WHERE messages.message_id=?", - new Object[]{mid}, (rs, num) -> { - User res = new com.juick.User(); - res.setUID(rs.getInt(1)); - res.setUName(rs.getString(2)); - return res; - }); + try { + return sql.queryForObject("SELECT messages.user_id,users.nick " + + "FROM messages INNER JOIN users " + + "ON messages.user_id=users.id WHERE messages.message_id=?", + new Object[]{mid}, (rs, num) -> { + User res = new com.juick.User(); + res.setUID(rs.getInt(1)); + res.setUName(rs.getString(2)); + return res; + }); + } catch (EmptyResultDataAccessException e) { + return null; + } } public static List<com.juick.Tag> getMessageTags(JdbcTemplate sql, int mid) { |