minetest.log overriding causes several crashes
Closed this issue · 3 comments
Line 11 in 939b150
This override causes crashes in MineClone and more mods
i'm very confused as why this should happen:
This line checks if 2 parameters are available:
if type(level) == "string" and type(msg) == "string" then
-- rest omitted
if either level
or msg
are anything other than of type string it just skips the internal logging (this works even with nil
)
Afterwards it just delegates to the old minetest.log
function and even returns the results perfectly.
Maybe it is too early in the morning but i don't see how this particular override should cause an error.
Also: i don't see my code in the stacktrace mentioned 🤔
(oh, and: i did test that mod with various games, including mineclone, and i even have one instance currently running without issues)
EDIT: nevermind, can reproduce this :/
ok, got it: the engine counts the parameters internally and does not check for type, even if it was passed ("msg", nil)
it would default to the 2-param code and fail in it (https://github.com/minetest/minetest/blob/833c32449858c72e1c4ddc2f9306e1f010693c76/src/script/lua_api/l_util.cpp#L53-L82)
Thanks for reporting 👍
thanks!