From 5a3b8e34b36a1f9b1f38f91483fc25d23b142f21 Mon Sep 17 00:00:00 2001 From: DTA7 Date: Thu, 21 Sep 2017 21:52:52 +0200 Subject: 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. --- src/script/cpp_api/s_item.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/script/cpp_api') diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp index d48a3aee9..3876272d7 100644 --- a/src/script/cpp_api/s_item.cpp +++ b/src/script/cpp_api/s_item.cpp @@ -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)) { -- cgit v1.2.3