Changeset

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
parents 3600:f32efd448794
children 3602:e302537a0e4e
files mod_csi_muc_priorities/mod_csi_muc_priorities.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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);