aboutsummaryrefslogtreecommitdiff
path: root/juick-server-xmpp
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-02 19:44:30 +0300
committerGravatar Vitaly Takmazov2018-04-02 19:44:30 +0300
commit32522d67e66c2d9adb2fb4d199b9e82172b95bf8 (patch)
tree7ce7365825263376841b4ffd015a941691a457cd /juick-server-xmpp
parent0311d123062ec05f13c2be47a92ef341877a2bf5 (diff)
XMPP: fix NPE
Diffstat (limited to 'juick-server-xmpp')
-rw-r--r--juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
index a60b506d..fbf1a529 100644
--- a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
+++ b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
@@ -624,8 +624,9 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
incomingMessageJuick(user_from, msg.getFrom(), msg.getBody().trim(), null);
}
} catch (Exception e) {
- return;
+ logger.info("xmpp exception", e);
}
+ return;
}
int uid_to = userService.getUIDbyName(username);
@@ -680,7 +681,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
// new message
List<Tag> tags = tagService.fromString(command, false);
String body = command.substring(TagUtils.toString(tags).length());
- String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
+ String attachmentType = attachment != null && StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
int mid = messagesService.createMessage(user_from.getUid(), body, attachmentType, tags);
subscriptionService.subscribeMessage(mid, user_from.getUid());
if (StringUtils.isNotEmpty(attachmentType)) {