diff options
author | Jeija <norrepli@gmail.com> | 2016-02-25 09:47:28 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-02-26 06:36:48 +0100 |
commit | 033a510cf3f5b6bc36c976bec18ab98e69fb0d5e (patch) | |
tree | da60545503695839003668a19d17e933b989ff91 /src/script/lua_api/l_util.cpp | |
parent | f9d727764fc9c74990fc979d4966a33882d0c19b (diff) | |
download | minetest-033a510cf3f5b6bc36c976bec18ab98e69fb0d5e.tar.gz minetest-033a510cf3f5b6bc36c976bec18ab98e69fb0d5e.tar.bz2 minetest-033a510cf3f5b6bc36c976bec18ab98e69fb0d5e.zip |
Fix minetest.request_insecure_environment() always returning nil
Fixes #3765
Diffstat (limited to 'src/script/lua_api/l_util.cpp')
-rw-r--r-- | src/script/lua_api/l_util.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index c04f09f90..cc4467bb6 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_security.h" #include "areastore.h" #include "porting.h" +#include "debug.h" #include "log.h" #include "tool.h" #include "filesys.h" @@ -372,8 +373,8 @@ int ModApiUtil::l_request_insecure_environment(lua_State *L) if (lua_getstack(L, 2, &info)) { return 0; } - assert(lua_getstack(L, 1, &info)); - assert(lua_getinfo(L, "S", &info)); + FATAL_ERROR_IF(!lua_getstack(L, 1, &info), "lua_getstack() failed"); + FATAL_ERROR_IF(!lua_getinfo(L, "S", &info), "lua_getinfo() failed"); // ...and that that item is the main file scope. if (strcmp(info.what, "main") != 0) { return 0; |