[lua] Fix crash calling io.open() without argument (fix #4159)

This commit is contained in:
David Capello 2023-11-20 14:34:50 -03:00
parent 1a3c32a93d
commit cc0f8d0dc4

View File

@ -73,7 +73,7 @@ int secure_io_open(lua_State* L)
{
int n = lua_gettop(L);
std::string absFilename = base::get_absolute_path(lua_tostring(L, 1));
std::string absFilename = base::get_absolute_path(luaL_checkstring(L, 1));
FileAccessMode mode = FileAccessMode::Read; // Read is the default access
if (lua_tostring(L, 2) &&