From 2535b334ec7ffc5d81d6f05df2449d6de8861b3b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Feb 2018 11:51:20 +0300 Subject: server: process empty ws attachments --- juick-server/src/main/java/com/juick/server/WebsocketManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'juick-server/src/main') 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(); -- cgit v1.2.3