diff util/pubsub.lua @ 11565:087b275a9aee 0.11

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.
author Kim Alvefur <zash@zash.se>
date Sun, 16 May 2021 16:02:00 +0200
parents 641e3b7a6a39
children c471e19a238e
line wrap: on
line diff
--- 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";