From 14a3b7858b5c4985407776a1364720e19e333145 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 10 Oct 2017 01:41:47 +0200 Subject: util.pubsub: Return item-not-found if a single item is requested, and not there --- util/pubsub.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util') 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 -- cgit v1.2.3