riddim.plugins.pubsub2room: Return early from extractor if no stanza given

Sun, 20 May 2018 01:57:58 +0200

author
Kim Alvefur <zash@zash.se>
date
Sun, 20 May 2018 01:57:58 +0200
changeset 138
7c95aba75a55
parent 137
d16c9dba9337
child 139
6de453570270

riddim.plugins.pubsub2room: Return early from extractor if no stanza given

plugins/pubsub2room.lua file | annotate | diff | comparison | revisions
--- a/plugins/pubsub2room.lua	Sun May 20 01:49:58 2018 +0200
+++ b/plugins/pubsub2room.lua	Sun May 20 01:57:58 2018 +0200
@@ -36,7 +36,8 @@
 };
 
 local function new_extractor(stanza, data)
-	return stanza and setmetatable({ stanza = stanza, data = data }, extractor_mt) or nil;
+	if not stanza then return nil end
+	return setmetatable({ stanza = stanza, data = data }, extractor_mt);
 end
 
 local last_message_time = 0;

mercurial