# HG changeset patch # User Kim Alvefur # Date 1636837959 -3600 # Node ID 313d01cc4258775d74d8fffc796b9ba5a4ec7e25 # Parent baf69f25475323992dec556eec010845c7090580 mod_pubsub: Fix traceback in disco of non-existent node (thanks Martin) In this case `ret` is a table not containing the node, which makes pubsub_error_reply() try to get an error template with that `ret` table as index, which returns a `nil` then passed to table.unpack, which in turn throws the error. diff -r baf69f254753 -r 313d01cc4258 plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Sat Nov 13 13:32:43 2021 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Sat Nov 13 22:12:39 2021 +0100 @@ -278,9 +278,13 @@ function _M.handle_disco_info_node(event, service) local stanza, reply, node = event.stanza, event.reply, event.node; local ok, ret = service:get_nodes(stanza.attr.from); + if not ok then + event.origin.send(pubsub_error_reply(stanza, ret)); + return true; + end local node_obj = ret[node]; - if not ok or not node_obj then - event.origin.send(pubsub_error_reply(stanza, ret or "item-not-found")); + if not node_obj then + event.origin.send(pubsub_error_reply(stanza, "item-not-found")); return true; end event.exists = true;