util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
authorMatthew Wild <mwild1@gmail.com>
Sat, 18 Aug 2018 14:21:02 +0100
changeset 9205 27d800ddc3b0
parent 9204 1555ea0d6f61
child 9206 c65bfddd3cc5
util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
util/pubsub.lua
--- a/util/pubsub.lua	Sat Aug 18 14:17:43 2018 +0100
+++ b/util/pubsub.lua	Sat Aug 18 14:21:02 2018 +0100
@@ -598,8 +598,8 @@
 	end
 	--
 
-	-- Check node exists
-	if not self.nodes[node] then
+	-- Check node exists and has an item published
+	if not (self.nodes[node] and self.data[node]) then
 		return false, "item-not-found";
 	end