Fix crash when accessing variables from a map generator
On some machines, the crash doesn't occur, but the variable is still not loaded correctly. Addresses #5896
This commit is contained in:
parent
2968aca834
commit
35911a3dcc
1 changed files with 5 additions and 3 deletions
|
@ -300,10 +300,12 @@ void mapgen_lua_kernel::user_config(const char * prog, const config & generator)
|
|||
|
||||
int mapgen_lua_kernel::intf_get_variable(lua_State *L)
|
||||
{
|
||||
|
||||
char const *m = luaL_checkstring(L, 1);
|
||||
variable_access_const v(m, vars_ ? *vars_ : config());
|
||||
return luaW_pushvariable(L, v) ? 1 : 0;
|
||||
if(vars_) {
|
||||
variable_access_const v(m, *vars_);
|
||||
return luaW_pushvariable(L, v) ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mapgen_lua_kernel::intf_get_all_vars(lua_State *L) {
|
||||
|
|
Loading…
Add table
Reference in a new issue