MUC: Fixed traceback when a JID not in a room requested a role change for an occupant.
authorWaqas Hussain <waqas20@gmail.com>
Tue, 1 Apr 2014 14:02:58 +0000 (10:02 -0400)
committerWaqas Hussain <waqas20@gmail.com>
Tue, 1 Apr 2014 14:02:58 +0000 (10:02 -0400)
plugins/muc/muc.lib.lua

index 0dbe81fae9255c17e72a28b809bfd57a61342c12..8028f5aee0e5cc9dc352930a27797cc3b2f6e246 100644 (file)
@@ -1060,7 +1060,7 @@ function room_mt:can_set_role(actor_jid, occupant_jid, role)
        if actor_jid == true then return true; end
 
        local actor = self._occupants[self._jid_nick[actor_jid]];
-       if actor.role == "moderator" then
+       if actor and actor.role == "moderator" then
                if occupant.affiliation ~= "owner" and occupant.affiliation ~= "admin" then
                        if actor.affiliation == "owner" or actor.affiliation == "admin" then
                                return true;