diff options
author | SmallJoker <mk939@ymail.com> | 2018-05-14 21:03:48 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2018-06-10 17:18:11 +0200 |
commit | 2515207606683d60a6657c7ea18189381dae157c (patch) | |
tree | a6d65504e88677a9e34e9239e5c0942d5293d195 /src/script | |
parent | 119aa5c91977ce5381e399e21eabf390e5cb5f5e (diff) | |
download | minetest-2515207606683d60a6657c7ea18189381dae157c.tar.gz minetest-2515207606683d60a6657c7ea18189381dae157c.tar.bz2 minetest-2515207606683d60a6657c7ea18189381dae157c.zip |
Fix crash in log_deprecated when triggered from no function
Based on commit a1598e1b
Diffstat (limited to 'src/script')
-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 3fa044172..3e28d9cf6 100644 --- a/src/script/common/c_internal.cpp +++ b/src/script/common/c_internal.cpp @@ -181,7 +181,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 << ")"; } |