mod_muc_members_json: Fix potential error when removing old affiliations
authorKim Alvefur <zash@zash.se>
Tue, 19 Sep 2023 14:55:56 +0200
changeset 5661 80abda15a1e9
parent 5660 c20b77e5e032
child 5662 7a4a6ded2bd6
mod_muc_members_json: Fix potential error when removing old affiliations Found this uncommitted change on a production server... The affiliation data may been `nil` at some point, triggering an error?
mod_muc_members_json/mod_muc_members_json.lua
--- a/mod_muc_members_json/mod_muc_members_json.lua	Tue Sep 19 13:22:00 2023 +0200
+++ b/mod_muc_members_json/mod_muc_members_json.lua	Tue Sep 19 14:55:56 2023 +0200
@@ -80,7 +80,7 @@
 					end
 					-- Remove affiliation from folk who weren't in the source data but previously were
 					for jid, aff, data in muc:each_affiliation() do
-						if not jids[jid] and data.source == module.name then
+						if not jids[jid] and data and data.source == module.name then
 							muc:set_affiliation(true, jid, "none", "imported membership lost");
 						end
 					end