Changeset

5680:80abda15a1e9

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?
author Kim Alvefur <zash@zash.se>
date Tue, 19 Sep 2023 14:55:56 +0200
parents 5679:c20b77e5e032
children 5681:7a4a6ded2bd6
files mod_muc_members_json/mod_muc_members_json.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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