aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-15 11:51:20 +0300
committerGravatar Vitaly Takmazov2018-02-15 11:51:20 +0300
commit2535b334ec7ffc5d81d6f05df2449d6de8861b3b (patch)
tree0eaafebcff5f6626237375dbdff3a676d10137ff /juick-server
parenta6112d0cc907b13c01dad86cd49569540ce80626 (diff)
server: process empty ws attachments
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/WebsocketManager.java3
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();