mod_csi_muc_priorities: Fix bad argument to 'ipairs' on a missing list
authorKim Alvefur <zash@zash.se>
Thu, 23 Apr 2020 22:07:44 +0200
changeset 3996 0233da912ab6
parent 3995 eb56e743abe8
child 3997 76036fa34055
mod_csi_muc_priorities: Fix bad argument to 'ipairs' on a missing list If either of the two list-multi are empty then apparently nothing thougth to include an empty array. Meh.
mod_csi_muc_priorities/mod_csi_muc_priorities.lua
--- a/mod_csi_muc_priorities/mod_csi_muc_priorities.lua	Thu Apr 23 20:12:42 2020 +0200
+++ b/mod_csi_muc_priorities/mod_csi_muc_priorities.lua	Thu Apr 23 22:07:44 2020 +0200
@@ -105,11 +105,15 @@
 	end
 	local prioritized_jids = {};
 	if fields.unimportant then
-		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
-		for _, jid in ipairs(fields.important) do
-			prioritized_jids[jid] = true;
+		if fields.important then
+			for _, jid in ipairs(fields.important) do
+				prioritized_jids[jid] = true;
+			end
 		end
 	end