moduleapi: Stricter type check for actor in permission check
authorKim Alvefur <zash@zash.se>
Wed, 20 Jul 2022 13:08:07 +0200
changeset 12656 30e2a0107217
parent 12655 1ce98f27eabe
child 12657 e4a412a54462
moduleapi: Stricter type check for actor in permission check Non-table but truthy values would trigger "attempt to index a foo value" on the next line otherwise
core/moduleapi.lua
--- a/core/moduleapi.lua	Wed Jul 20 13:07:04 2022 +0200
+++ b/core/moduleapi.lua	Wed Jul 20 13:08:07 2022 +0200
@@ -645,7 +645,7 @@
 	end
 
 	local session = context.origin or context.session;
-	if not session then
+	if type(session) ~= "table" then
 		error("Unable to identify actor session from context");
 	end
 	if session.type == "s2sin" or (session.type == "c2s" and session.host ~= self.host) then