summaryrefslogtreecommitdiff
path: root/builtin/game/chatcommands.lua
diff options
context:
space:
mode:
authorraymoo <raymoo@users.noreply.github.com>2017-10-28 01:30:50 -0700
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit7b8288d605260a92693a93a85134555a8c975bb9 (patch)
tree9c14b93d6f23213f912d7e3d8f58882ba2aeeac8 /builtin/game/chatcommands.lua
parent2f969196b86a9ffd4ef3bce9b17fcfb49ec89cd2 (diff)
downloadminetest-7b8288d605260a92693a93a85134555a8c975bb9.tar.gz
minetest-7b8288d605260a92693a93a85134555a8c975bb9.tar.bz2
minetest-7b8288d605260a92693a93a85134555a8c975bb9.zip
Fix default item callbacks to work with nil users (#5819)
* Fix default item callbacks to work with nil users * item.lua: Handle node drops for invalid players The if-condition for the dropping loop is the same as `inv`, which means that the 2nd possible definition of `give_item` is never used. Remove redundant `local _, dropped_item`
Diffstat (limited to 'builtin/game/chatcommands.lua')
-rw-r--r--builtin/game/chatcommands.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua
index 3dfc29ffa..e788a2a54 100644
--- a/builtin/game/chatcommands.lua
+++ b/builtin/game/chatcommands.lua
@@ -653,8 +653,8 @@ core.register_chatcommand("pulverize", {
core.rollback_punch_callbacks = {}
core.register_on_punchnode(function(pos, node, puncher)
- local name = puncher:get_player_name()
- if core.rollback_punch_callbacks[name] then
+ local name = puncher and puncher:get_player_name()
+ if name and core.rollback_punch_callbacks[name] then
core.rollback_punch_callbacks[name](pos, node, puncher)
core.rollback_punch_callbacks[name] = nil
end