From 4208fdfd2273b715eeddb8b9877c2def8346d447 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Tue, 17 Feb 2015 20:09:36 +0100 Subject: Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable) --- src/script/lua_api/l_rollback.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/script') diff --git a/src/script/lua_api/l_rollback.cpp b/src/script/lua_api/l_rollback.cpp index f55a72d1b..5744e6813 100644 --- a/src/script/lua_api/l_rollback.cpp +++ b/src/script/lua_api/l_rollback.cpp @@ -44,6 +44,9 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L) int limit = luaL_checknumber(L, 4); Server *server = getServer(L); IRollbackManager *rollback = server->getRollbackManager(); + if (rollback == NULL) { + return 0; + } std::list actions = rollback->getNodeActors(pos, range, seconds, limit); std::list::iterator iter = actions.begin(); @@ -80,6 +83,13 @@ int ModApiRollback::l_rollback_revert_actions_by(lua_State *L) int seconds = luaL_checknumber(L, 2); Server *server = getServer(L); IRollbackManager *rollback = server->getRollbackManager(); + + // If rollback is disabled, tell it's not a success. + if (rollback == NULL) { + lua_pushboolean(L, false); + lua_newtable(L); + return 2; + } std::list actions = rollback->getRevertActions(actor, seconds); std::list log; bool success = server->rollbackRevertActions(actions, &log); -- cgit v1.2.3