1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Merge pull request #385 from adiaholic/bugFix

Remove unexpected `MucNotJoinedException` from `MultiUserChat.leave()`
This commit is contained in:
Florian Schmaus 2020-04-17 21:02:14 +02:00 committed by GitHub
commit 72b9f79692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 // "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. // 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; final EntityFullJid myRoomJid = this.myRoomJid;
if (myRoomJid == null) { if (myRoomJid == null) {
throw new MucNotJoinedException(this); 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(); Presence reflectedLeavePresence = connection.createStanzaCollectorAndSend(reflectedLeavePresenceFilter, leavePresence).nextResultOrThrow();
return reflectedLeavePresence; return reflectedLeavePresence;