--- ./source/smack/Smack-4.4.0-alpha3-20200404/org/jivesoftware/smackx/muc/MultiUserChat.java	2020-03-24 09:16:12.000000000
+++ ./workspace/android/atalk-android/aTalk/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java	2020-04-05 16:03:00.000000000
@@ -237,14 +237,25 @@
                         checkPresenceCode(
                             mucUser.getStatus(),
                             presence.getFrom().equals(myRoomJID),
                             mucUser,
                             from);
                     } else {
+                        // The room has been destroyed.
+                        if (mucUser != null && mucUser.getDestroy() != null) {
+                            // Reset occupant information.
+                            userHasLeft();
+                            myRoomJid = null;
+
+                            MultiUserChat alternateMUC = multiUserChatManager.getMultiUserChat(mucUser.getDestroy().getJid());
+                            for (UserStatusListener listener : userStatusListeners) {
+                                listener.roomDestroyed(alternateMUC, mucUser.getDestroy().getReason());
+                            }
+                        }
                         // An occupant has left the room
-                        if (!isUserStatusModification) {
+                        else if (!isUserStatusModification) {
                             for (ParticipantStatusListener listener : participantStatusListeners) {
                                 listener.left(from);
                             }
                         }
                     }
                     break;
@@ -995,14 +1006,14 @@
         return invitationRejectionListeners.remove(listener);
     }
 
     /**
      * Fires invitation rejection listeners.
      *
-     * @param invitee the user being invited.
-     * @param reason the reason for the rejection
+     * @param message the message to use for sending the rejection.
+     * @param rejection the raw decline found in the message
      */
     private void fireInvitationRejectionListeners(Message message, MUCUser.Decline rejection) {
         EntityBareJid invitee = rejection.getFrom();
         String reason = rejection.getReason();
         InvitationRejectionListener[] listeners;
         synchronized (invitationRejectionListeners) {
@@ -2451,60 +2462,44 @@
             }
         }
         // A user was banned from the room
         if (statusCodes.contains(Status.BANNED_301)) {
             // Check if this occupant was banned
             if (isUserModification) {
-                joined = false;
+                // Reset occupant information.
+                userHasLeft();
+                myRoomJid = null;
+
                 for (UserStatusListener listener : userStatusListeners) {
                     listener.banned(mucUser.getItem().getActor(), mucUser.getItem().getReason());
                 }
-
-                // Reset occupant information.
-                occupantsMap.clear();
-                myRoomJid = null;
-                userHasLeft();
             }
             else {
                 for (ParticipantStatusListener listener : participantStatusListeners) {
                     listener.banned(from, mucUser.getItem().getActor(), mucUser.getItem().getReason());
                 }
             }
         }
         // A user's membership was revoked from the room
         if (statusCodes.contains(Status.REMOVED_AFFIL_CHANGE_321)) {
             // Check if this occupant's membership was revoked
             if (isUserModification) {
-                joined = false;
+                // Reset occupant information.
+                userHasLeft();
+                myRoomJid = null;
+
                 for (UserStatusListener listener : userStatusListeners) {
                     listener.membershipRevoked();
                 }
-
-                // Reset occupant information.
-                occupantsMap.clear();
-                myRoomJid = null;
-                userHasLeft();
             }
         }
         // A occupant has changed his nickname in the room
         if (statusCodes.contains(Status.NEW_NICKNAME_303)) {
             for (ParticipantStatusListener listener : participantStatusListeners) {
                 listener.nicknameChanged(from, mucUser.getItem().getNick());
             }
-        }
-        // The room has been destroyed.
-        if (mucUser.getDestroy() != null) {
-            MultiUserChat alternateMUC = multiUserChatManager.getMultiUserChat(mucUser.getDestroy().getJid());
-            for (UserStatusListener listener : userStatusListeners) {
-                listener.roomDestroyed(alternateMUC, mucUser.getDestroy().getReason());
-            }
-
-            // Reset occupant information.
-            occupantsMap.clear();
-            myRoomJid = null;
-            userHasLeft();
         }
     }
 
     /**
      * Get the XMPP connection associated with this chat instance.
      *
