Skip to content

Commit

Permalink
Update class.lua
Browse files Browse the repository at this point in the history
According to the documentation, `compat.getfenv` may return nil such that `env` may be nil.
  • Loading branch information
jlaurens committed Aug 3, 2024
1 parent e5e47e0 commit b731b62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/pl/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b731b62

Please sign in to comment.