Changeset

12652:30e2a0107217

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
author Kim Alvefur <zash@zash.se>
date Wed, 20 Jul 2022 13:08:07 +0200
parents 12651:1ce98f27eabe
children 12653:e4a412a54462
files core/moduleapi.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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