aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/MessagesQueries.java')
-rw-r--r--src/main/java/com/juick/server/MessagesQueries.java22
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) {