Diff

util/pubsub.lua @ 5675:e29ece65e3b0

util.pubsub: Check whether node exists, when deleting
author Florian Zeitz <florob@babelmonkeys.de>
date Wed, 12 Jun 2013 16:53:51 +0200
parent 5628:ba5c2f6b799e
child 5776:bd0ff8ae98a8
line wrap: on
line diff
--- a/util/pubsub.lua	Tue Jun 11 21:44:53 2013 +0100
+++ b/util/pubsub.lua	Wed Jun 12 16:53:51 2013 +0200
@@ -233,6 +233,9 @@
 	end
 	--
 	local node_obj = self.nodes[node];
+	if not node_obj then
+		return false, "item-not-found";
+	end
 	self.nodes[node] = nil;
 	self.config.broadcaster("delete", node, node_obj.subscribers);
 	return true;