aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();