aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/WebsocketManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-15 11:37:08 +0300
committerGravatar Vitaly Takmazov2018-02-15 11:37:08 +0300
commita6112d0cc907b13c01dad86cd49569540ce80626 (patch)
tree9096fa91cf2aa59e3943a9a8f55339eedf06e2d1 /juick-server/src/main/java/com/juick/server/WebsocketManager.java
parentb28fe90514ef57706ab1219e7eda517bf3198f26 (diff)
server: validate ws message
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/WebsocketManager.java')
-rw-r--r--juick-server/src/main/java/com/juick/server/WebsocketManager.java4
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();
}