diff options
author | SmallJoker <mk939@ymail.com> | 2018-05-14 21:03:48 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-05-14 21:19:52 +0200 |
commit | a1598e1b83e28503745165d5749cd21b77e97818 (patch) | |
tree | 3f5388c0f8d18fb2d35c345f53014e7cd234ecb8 /src/script/common | |
parent | a01a9ca24cf74434d3d9d558d50e24d7de514e03 (diff) | |
download | minetest-a1598e1b83e28503745165d5749cd21b77e97818.tar.gz minetest-a1598e1b83e28503745165d5749cd21b77e97818.tar.bz2 minetest-a1598e1b83e28503745165d5749cd21b77e97818.zip |
Fix segfault in player migration and crash in log_deprecated
Makes log_deprecated work when triggered from no function
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_internal.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp index 3d766a955..9a24b0e78 100644 --- a/src/script/common/c_internal.cpp +++ b/src/script/common/c_internal.cpp @@ -153,7 +153,9 @@ void log_deprecated(lua_State *L, const std::string &message) warningstream << message; if (L) { // L can be NULL if we get called from scripting_game.cpp lua_Debug ar; - FATAL_ERROR_IF(!lua_getstack(L, 2, &ar), "lua_getstack() failed"); + + if (!lua_getstack(L, 2, &ar)) + FATAL_ERROR_IF(!lua_getstack(L, 1, &ar), "lua_getstack() failed"); FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed"); warningstream << " (at " << ar.short_src << ":" << ar.currentline << ")"; } |