Diff

util/pubsub.lua @ 9202:27d800ddc3b0

util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Aug 2018 14:21:02 +0100
parent 9201:1555ea0d6f61
child 9203:c65bfddd3cc5
line wrap: on
line diff
--- 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