changeset 3992:0233da912ab6

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.
author Kim Alvefur <zash@zash.se>
date Thu, 23 Apr 2020 22:07:44 +0200
parents eb56e743abe8
children 76036fa34055
files mod_csi_muc_priorities/mod_csi_muc_priorities.lua
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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