util.pubsub: Fix traceback if node data not initialized 0.11
authorKim Alvefur <zash@zash.se>
Sun, 16 May 2021 16:02:00 +0200
branch0.11
changeset 11569 087b275a9aee
parent 11563 56785f32e1d4
child 11570 6e67872bcba4
util.pubsub: Fix traceback if node data not initialized This should not be possible, but a traceback indicating node_data being nil here was reported by Ron in the chat.
util/pubsub.lua
--- a/util/pubsub.lua	Wed May 12 16:42:51 2021 +0100
+++ b/util/pubsub.lua	Sun May 16 16:02:00 2021 +0200
@@ -555,6 +555,10 @@
 		return nil, "invalid-item";
 	end
 	local node_data = self.data[node];
+	if not node_data then
+		-- FIXME how is this possible?  #1657
+		return nil, "internal-server-error";
+	end
 	local ok = node_data:set(id, item);
 	if not ok then
 		return nil, "internal-server-error";