summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/sandbox/sandbox.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/sandbox/sandbox.lua b/xmake/core/sandbox/sandbox.lua
index f7196a242..766e6061c 100644
--- a/xmake/core/sandbox/sandbox.lua
+++ b/xmake/core/sandbox/sandbox.lua
@@ -323,7 +323,10 @@ function sandbox.instance(script)
while level < 32 do
-- get scope
- local scope = getfenv(level)
+ local ok, scope = pcall(getfenv, level)
+ if not ok then
+ break;
+ end
if scope then
-- enable to read _SANDBOX
@@ -344,8 +347,6 @@ function sandbox.instance(script)
-- next
level = level + 1
end
-
- -- ok?
return instance
end