diff options
author | Vitaly Takmazov | 2018-02-15 11:37:08 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-15 11:37:08 +0300 |
commit | a6112d0cc907b13c01dad86cd49569540ce80626 (patch) | |
tree | 9096fa91cf2aa59e3943a9a8f55339eedf06e2d1 /juick-server/src/main/java/com/juick | |
parent | b28fe90514ef57706ab1219e7eda517bf3198f26 (diff) |
server: validate ws message
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 |
1 files changed, 3 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 a260817d..0fa3c84c 100644 --- a/juick-server/src/main/java/com/juick/server/WebsocketManager.java +++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java @@ -147,7 +147,9 @@ public class WebsocketManager extends TextWebSocketHandler { if (c.visitor.getName().equals(serviceUser)) { try { Message draft = jsonMapper.readValue(message.asBytes(), Message.class); - serverManager.processMessage(draft.getUser(), draft.getText(), draft.getAttachment().getUrl()); + if (draft.getUser() != null && (draft.getText() != null || draft.getAttachment() != null)) { + serverManager.processMessage(draft.getUser(), draft.getText(), draft.getAttachment().getUrl()); + } } catch (IOException e) { throw new HttpBadRequestException(); } |