mod_pubsub: Only assign id to item element if there is one
authorMatthew Wild <mwild1@gmail.com>
Wed, 17 Apr 2013 13:32:26 +0000 (14:32 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 17 Apr 2013 13:32:26 +0000 (14:32 +0100)
plugins/mod_pubsub.lua

index 4d3911bb85fae5dd9cf7c88d88565507c9e941f7..22969ab5f067d9fee54364c8ffc933d9fcf6bb99 100644 (file)
@@ -193,7 +193,9 @@ function handlers.set_publish(origin, stanza, publish)
        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;