From b731b6265344530b4ee810e8e0eba0b500d40b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAURENS=20J=C3=A9r=C3=B4me?= Date: Sat, 3 Aug 2024 08:26:10 +0200 Subject: [PATCH] Update class.lua According to the documentation, `compat.getfenv` may return nil such that `env` may be nil. --- lua/pl/class.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/pl/class.lua b/lua/pl/class.lua index cd041c82..98b5c2ac 100644 --- a/lua/pl/class.lua +++ b/lua/pl/class.lua @@ -227,7 +227,9 @@ class = setmetatable({},{ return function(...) local c = _class(...) c._name = key - rawset(env,key,c) + if env then + rawset(env,key,c) + end return c end end