riddim.plugins.pubsub2room: Return early in case of unconfigured pubsub event

Sun, 20 May 2018 03:13:23 +0200

author
Kim Alvefur <zash@zash.se>
date
Sun, 20 May 2018 03:13:23 +0200
changeset 141
be0754cc0ede
parent 140
4aa787757235
child 142
211fa13c7ca2

riddim.plugins.pubsub2room: Return early in case of unconfigured pubsub event

plugins/pubsub2room.lua file | annotate | diff | comparison | revisions
--- a/plugins/pubsub2room.lua	Sun May 20 02:16:48 2018 +0200
+++ b/plugins/pubsub2room.lua	Sun May 20 03:13:23 2018 +0200
@@ -50,6 +50,7 @@
 	local config = bot.config.pubsub2room;
 	bot.stream:hook("pubsub/event", function(event)
 		local conf = config[event.from .. "#" .. event.node];
+		if not conf then return end
 		local room = bot.rooms[conf.room];
 		local data = st.stanza(""):tag("id"):text(event.item.attr.id);
 		local entry = event.item and new_extractor(event.item.tags[1], data)

mercurial