From 03a267a9259b6ea7a4631c3cdb89593a7a6fdca8 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Tue, 12 Jun 2018 09:49:08 +0200 Subject: [PATCH] fix: Prevent attempt to construct invalid address When no join was properly registered, a nickname will not be defined. In that case, attempting to construct the from address for the 'leave' presence stanza will result in: java.lang.IllegalArgumentException: The Resourcepart must not be null This commit prevents that, by verifying that the nickname is non-null, before sending that stanza. --- .../main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java index c22995cd6..56b25ac87 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -756,6 +756,10 @@ public class MultiUserChat { // throw. userHasLeft(); + if (nickname == null) { + return; + } + // We leave a room by sending a presence packet where the "to" // field is in the form "roomName@service/nickname" Presence leavePresence = new Presence(Presence.Type.unavailable);