changeset 3387:c5e8042b174c

mod_delegation: avoid crash on recent prosody versions
author Goffi <goffi@goffi.org>
date Sat, 01 Dec 2018 12:10:31 +0100
parents a76c420eca61
children 7454274ead2f
files mod_delegation/mod_delegation.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_delegation/mod_delegation.lua	Fri Nov 30 19:31:25 2018 +0100
+++ b/mod_delegation/mod_delegation.lua	Sat Dec 01 12:10:31 2018 +0100
@@ -350,7 +350,7 @@
 local function feature_added(event)
 	local source, item = event.source, event.item
 	for namespace, _ in pairs(ns_delegations) do
-		if source ~= module and string.sub(item, 1, #namespace) == namespace then
+		if source ~= nil and source ~= module and string.sub(item, 1, #namespace) == namespace then
 			module:log("debug", "Removing %s feature which is delegated", item)
 			source:remove_item("feature", item)
 			disabled_modules:add(source)
@@ -373,7 +373,7 @@
 	if not form_type then return end
 
 	for namespace, _ in pairs(ns_delegations) do
-		if source ~= module and string.sub(form_type, 1, #namespace) == namespace then
+		if source ~= nil and source ~= module and string.sub(form_type, 1, #namespace) == namespace then
 			module:log("debug", "Removing extension which is delegated: %s", tostring(stanza))
 			source:remove_item("extension", stanza)
 		end