Changeset

9201:1555ea0d6f61

util.pubsub: get_last_item(): Return error if node does not exist
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Aug 2018 14:17:43 +0100
parents 9200:249d90ff992e
children 9202:27d800ddc3b0
files util/pubsub.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/pubsub.lua	Sat Aug 18 14:06:56 2018 +0100
+++ b/util/pubsub.lua	Sat Aug 18 14:17:43 2018 +0100
@@ -597,6 +597,12 @@
 		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