From cdd5608f4a42e7740536d09eeda14451924c9657 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 20 Jul 2022 13:08:07 +0200
Subject: 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'core')

diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index c1d8851e..8790a9d3 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -645,7 +645,7 @@ function api:may(action, context)
 	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
-- 
cgit v1.2.3