aboutsummaryrefslogtreecommitdiffstats
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
commit6643aeb7e69f9ec75687fae9d9fd1434213645f3 (patch)
treea21ea35414a2815009a972eef900be112d8819db
parent716c68f983333e3890a4deb0c5151af1b9d77b0e (diff)
downloadprosody-6643aeb7e69f9ec75687fae9d9fd1434213645f3.tar.gz
prosody-6643aeb7e69f9ec75687fae9d9fd1434213645f3.zip
util.pubsub: get_last_item(): Return error if node does not exist
-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