diff options
author | Vitaly Takmazov | 2018-02-15 11:51:20 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-15 11:51:20 +0300 |
commit | 2535b334ec7ffc5d81d6f05df2449d6de8861b3b (patch) | |
tree | 0eaafebcff5f6626237375dbdff3a676d10137ff | |
parent | a6112d0cc907b13c01dad86cd49569540ce80626 (diff) |
server: process empty ws attachments
-rw-r--r-- | juick-server/src/main/java/com/juick/server/WebsocketManager.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/WebsocketManager.java b/juick-server/src/main/java/com/juick/server/WebsocketManager.java index 0fa3c84c..00d6dd28 100644 --- a/juick-server/src/main/java/com/juick/server/WebsocketManager.java +++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java @@ -148,7 +148,8 @@ public class WebsocketManager extends TextWebSocketHandler { try { Message draft = jsonMapper.readValue(message.asBytes(), Message.class); if (draft.getUser() != null && (draft.getText() != null || draft.getAttachment() != null)) { - serverManager.processMessage(draft.getUser(), draft.getText(), draft.getAttachment().getUrl()); + String attachmentFileName = draft.getAttachment() == null ? "" : draft.getAttachment().getUrl(); + serverManager.processMessage(draft.getUser(), draft.getText(), attachmentFileName); } } catch (IOException e) { throw new HttpBadRequestException(); |