Diff

mod_csi_muc_priorities/mod_csi_muc_priorities.lua @ 3601:013ef96a6d4d

mod_csi_muc_priorities: Fix traceback due to empty field The 'jid-multi' field reader returns nil if there are zero items.
author Kim Alvefur <zash@zash.se>
date Sat, 18 May 2019 16:19:03 +0200
parent 3540:1b45bac50f3d
child 3628:2444fb3b05b7
line wrap: on
line diff
--- a/mod_csi_muc_priorities/mod_csi_muc_priorities.lua	Thu May 16 08:48:09 2019 +0200
+++ b/mod_csi_muc_priorities/mod_csi_muc_priorities.lua	Sat May 18 16:19:03 2019 +0200
@@ -86,8 +86,10 @@
 		return { status = "completed", error = { message = "Problem in submitted form" } };
 	end
 	local prioritized_jids = {};
-	for _, jid in ipairs(fields.unimportant) do
-		prioritized_jids[jid] = false;
+	if fields.unimportant then
+		for _, jid in ipairs(fields.unimportant) do
+			prioritized_jids[jid] = false;
+		end
 	end
 
 	local username = jid_split(data.from);