aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-10-10 01:41:47 +0200
committerKim Alvefur <zash@zash.se>2017-10-10 01:41:47 +0200
commit1b147b03d42fe9dec4e17a3238cf037f470d13b4 (patch)
tree16bebf3d854ef9ac034eef32e6da8c7595df665f /util/pubsub.lua
parent28ea139bbb261257bf48ab0ef606ea39ba520e71 (diff)
downloadprosody-1b147b03d42fe9dec4e17a3238cf037f470d13b4.tar.gz
prosody-1b147b03d42fe9dec4e17a3238cf037f470d13b4.zip
util.pubsub: Return item-not-found if a single item is requested, and not there
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index cae13521..9b38bf59 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -338,7 +338,11 @@ function service:get_items(node, actor, id)
return false, "item-not-found";
end
if id then -- Restrict results to a single specific item
- return true, { id, [id] = self.data[node]:get(id) };
+ local with_id = self.data[node]:get(id);
+ if not with_id then
+ return false, "item-not-found";
+ end
+ return true, { id, [id] = with_id };
else
local data = {}
for key, value in self.data[node]:items() do