mod_blocking: Make sure that there is a lists item in the privacy store
authorKim Alvefur <zash@zash.se>
Mon, 28 Oct 2013 11:10:02 +0100
changeset 1215 1b55d8f86644
parent 1214 a234ad611633
child 1216 81a3bf8aba90
mod_blocking: Make sure that there is a lists item in the privacy store
mod_blocking/mod_blocking.lua
--- a/mod_blocking/mod_blocking.lua	Thu Oct 24 11:52:58 2013 -0400
+++ b/mod_blocking/mod_blocking.lua	Mon Oct 28 11:10:02 2013 +0100
@@ -9,6 +9,9 @@
 function add_blocked_jid(username, host, jid)
 	local privacy_lists = datamanager.load(username, host, "privacy") or {lists = {}};
 	local default_list_name = privacy_lists.default;
+	if not privacy_lists.lists then
+		privacy_lists.lists = {}
+	end
 	if not default_list_name then
 		default_list_name = "blocklist";
 		privacy_lists.default = default_list_name;