aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/server/MessagesQueries.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/com/juick/server/MessagesQueries.java b/src/main/java/com/juick/server/MessagesQueries.java
index 77998d16..cd098ec6 100644
--- a/src/main/java/com/juick/server/MessagesQueries.java
+++ b/src/main/java/com/juick/server/MessagesQueries.java
@@ -155,16 +155,18 @@ public class MessagesQueries {
}
public static boolean canViewThread(JdbcTemplate sql, int mid, int uid) {
-
- PrivacyOpts privacyOpts = sql.queryForObject("SELECT user_id,privacy FROM messages WHERE messages.message_id=?",
- new Object[] {mid},
- (rs, rowNum) -> {
- PrivacyOpts res = new PrivacyOpts();
- res.setUid(rs.getInt(1));
- res.setPrivacy(rs.getInt(2));
- return res;
- });
-
+ PrivacyOpts privacyOpts;
+ try {
+ privacyOpts = sql.queryForObject("SELECT user_id,privacy FROM messages WHERE messages.message_id=?",
+ (rs, rowNum) -> {
+ PrivacyOpts res = new PrivacyOpts();
+ res.setUid(rs.getInt(1));
+ res.setPrivacy(rs.getInt(2));
+ return res;
+ }, mid);
+ } catch (EmptyResultDataAccessException e) {
+ return true;
+ }
return privacyOpts.getPrivacy() >= 0
|| uid == privacyOpts.getUid()
|| ((privacyOpts.getPrivacy() == -1 || privacyOpts.getPrivacy() == -2) && uid > 0