mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix crash when a error occurs in a globalstep callback
This commit is contained in:
parent
fbef701bcd
commit
458045d49f
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
#include "mapgen.h"
|
#include "mapgen.h"
|
||||||
#include "lua_api/l_env.h"
|
#include "lua_api/l_env.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
void ScriptApiEnv::environment_OnGenerated(v3s16 minp, v3s16 maxp,
|
void ScriptApiEnv::environment_OnGenerated(v3s16 minp, v3s16 maxp,
|
||||||
u32 blockseed)
|
u32 blockseed)
|
||||||
@ -50,7 +51,11 @@ void ScriptApiEnv::environment_Step(float dtime)
|
|||||||
lua_getfield(L, -1, "registered_globalsteps");
|
lua_getfield(L, -1, "registered_globalsteps");
|
||||||
// Call callbacks
|
// Call callbacks
|
||||||
lua_pushnumber(L, dtime);
|
lua_pushnumber(L, dtime);
|
||||||
|
try {
|
||||||
script_run_callbacks(L, 1, RUN_CALLBACKS_MODE_FIRST);
|
script_run_callbacks(L, 1, RUN_CALLBACKS_MODE_FIRST);
|
||||||
|
} catch (LuaError &e) {
|
||||||
|
getServer()->setAsyncFatalError(e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptApiEnv::environment_OnMapgenInit(MapgenParams *mgparams)
|
void ScriptApiEnv::environment_OnMapgenInit(MapgenParams *mgparams)
|
||||||
|
Loading…
Reference in New Issue
Block a user