From 22cff274bb895b338f256b7f6c081169c77e877c Mon Sep 17 00:00:00 2001 From: adiaholic Date: Fri, 17 Apr 2020 20:10:45 +0530 Subject: [PATCH] Remove unexpected `MucNotJoinedException` from `MultiUserChat.leave()` Occupant information should be reset after `leavePresence` and `reflectedLeavePresenceFilter` are built. --- .../java/org/jivesoftware/smackx/muc/MultiUserChat.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 7c2d0950b..8c8b50647 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 @@ -732,10 +732,6 @@ public class MultiUserChat { // "if (!joined) return" because it should be always be possible to leave the room in case the instance's // state does not reflect the actual state. - // Reset occupant information first so that we are assume that we left the room even if sendStanza() would - // throw. - userHasLeft(); - final EntityFullJid myRoomJid = this.myRoomJid; if (myRoomJid == null) { throw new MucNotJoinedException(this); @@ -757,6 +753,10 @@ public class MultiUserChat { ) ); + // Reset occupant information first so that we are assume that we left the room even if sendStanza() would + // throw. + userHasLeft(); + Presence reflectedLeavePresence = connection.createStanzaCollectorAndSend(reflectedLeavePresenceFilter, leavePresence).nextResultOrThrow(); return reflectedLeavePresence;