Changeset

1736:efbb73851af9

mod_adhoc_blacklist: Fix traceback if blacklist is empty
author Kim Alvefur <zash@zash.se>
date Sat, 16 May 2015 14:46:29 +0200
parents 1735:c2d43b568178
children 1737:2ee9725c7fc6
files mod_adhoc_blacklist/mod_adhoc_blacklist.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_adhoc_blacklist/mod_adhoc_blacklist.lua	Thu May 14 00:34:00 2015 +0200
+++ b/mod_adhoc_blacklist/mod_adhoc_blacklist.lua	Sat May 16 14:46:29 2015 +0200
@@ -34,8 +34,10 @@
 local blocklist_handler = adhoc_inital_data(blocklist_form, function ()
 	local blacklistjids = {};
 	local blacklist = blocklists:get();
-	for jid in pairs(blacklist) do
-		table.insert(blacklistjids, jid);
+	if blacklist then
+		for jid in pairs(blacklist) do
+			table.insert(blacklistjids, jid);
+		end
 	end
 	return { blacklistjids = blacklistjids };
 end, function(fields, form_err)