mod_pubsub: Only assign id to item element if there is one
authorMatthew Wild <mwild1@gmail.com>
Wed, 17 Apr 2013 14:32:26 +0100
changeset 5481 169772e3d4e0
parent 5479 81c599c7588b
child 5482 f2631a14b953
mod_pubsub: Only assign id to item element if there is one
plugins/mod_pubsub.lua
--- a/plugins/mod_pubsub.lua	Wed Apr 17 14:12:47 2013 +0100
+++ b/plugins/mod_pubsub.lua	Wed Apr 17 14:32:26 2013 +0100
@@ -193,7 +193,9 @@
 	local id = (item and item.attr.id);
 	if not id then
 		id = uuid_generate();
-		item.attr.id = id;
+		if item then
+			item.attr.id = id;
+		end
 	end
 	local ok, ret = service:publish(node, stanza.attr.from, id, item);
 	local reply;