aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-18 14:17:43 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-18 14:17:43 +0100
commit678f4c2c7836000e9a10c89e81b938f8d941c0c6 (patch)
treea21ea35414a2815009a972eef900be112d8819db /util/pubsub.lua
parente3daae729d23ed2514d313f38e37d4967460fdff (diff)
downloadprosody-678f4c2c7836000e9a10c89e81b938f8d941c0c6.tar.gz
prosody-678f4c2c7836000e9a10c89e81b938f8d941c0c6.zip
util.pubsub: get_last_item(): Return error if node does not exist
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 628fdc59..72f7f5a7 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -597,6 +597,12 @@ function service:get_last_item(node, actor)
return false, "forbidden";
end
--
+
+ -- Check node exists
+ if not self.nodes[node] then
+ return false, "item-not-found";
+ end
+
-- Returns success, id, item
return true, self.data[node]:tail();
end