Mercurial > prosody-modules
diff mod_muc_restrict_avatars/mod_muc_restrict_avatars.lua @ 5896:5b95e06d75d5
Guard for not room
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Tue, 30 Apr 2024 15:06:03 -0500 |
parents | 66e7d46b1d4b |
children |
line wrap: on
line diff
--- a/mod_muc_restrict_avatars/mod_muc_restrict_avatars.lua Tue Apr 09 14:44:52 2024 -0500 +++ b/mod_muc_restrict_avatars/mod_muc_restrict_avatars.lua Tue Apr 30 15:06:03 2024 -0500 @@ -30,7 +30,7 @@ local room, fields, changed = event.room, event.fields, event.changed; local restrict_avatars = fields["restrict_avatars"]; - if restrict_avatars ~= is_avatar_restriction_enabled(room) then + if room and restrict_avatars ~= is_avatar_restriction_enabled(room) then -- Update room settings based on the submitted value room._data.restrict_avatars = restrict_avatars; -- Mark the configuration as changed @@ -46,7 +46,7 @@ module:hook("presence/full", function(event) local stanza = event.stanza; local room = mod_muc.get_room_from_jid(bare_jid(stanza.attr.to)); - if not room:get_affiliation(stanza.attr.from) then + if room and not room:get_affiliation(stanza.attr.from) then if is_avatar_restriction_enabled(room) then stanza:maptags(filter_avatar_advertisement); end