Fix crash when require is called from root VM stack

This commit is contained in:
Alex Orlenko 2025-04-24 22:30:20 +01:00
parent 217c14d293
commit fb324d18aa
No known key found for this signature in database
GPG key ID: 4C150C250863B96D

View file

@ -43,7 +43,8 @@ static bool isCached(lua_State* L, const std::string& key)
static ResolvedRequire resolveRequire(luarequire_Configuration* lrc, lua_State* L, void* ctx, std::string path) static ResolvedRequire resolveRequire(luarequire_Configuration* lrc, lua_State* L, void* ctx, std::string path)
{ {
lua_Debug ar; lua_Debug ar;
lua_getinfo(L, 1, "s", &ar); if (!lua_getinfo(L, 1, "s", &ar))
luaL_error(L, "require is not supported in this context");
if (!lrc->is_require_allowed(L, ctx, ar.source)) if (!lrc->is_require_allowed(L, ctx, ar.source))
luaL_error(L, "require is not supported in this context"); luaL_error(L, "require is not supported in this context");