1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Set placer to nil instead of a non-functional one in item_OnPlace (#6449)

* Set placer to nil instead of a non-functional one

This requires nil checks in core.rotate_node and core.rotate_and_place.
This commit is contained in:
DTA7 2017-09-21 21:52:52 +02:00 committed by Loïc Blot
parent 67f97f8d32
commit 5a3b8e34b3
3 changed files with 16 additions and 10 deletions

View file

@ -69,7 +69,12 @@ bool ScriptApiItem::item_OnPlace(ItemStack &item,
// Call function
LuaItemStack::create(L, item);
objectrefGetOrCreate(L, placer);
if (!placer)
lua_pushnil(L);
else
objectrefGetOrCreate(L, placer);
pushPointedThing(pointed);
PCALL_RES(lua_pcall(L, 3, 1, error_handler));
if (!lua_isnil(L, -1)) {