diff options
author | Auke Kok <sofar+github@foo-projects.org> | 2017-03-15 00:04:53 -0700 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-03-15 08:04:53 +0100 |
commit | b539985ab827c2eb025ecb28cf1a97bdd3c75d58 (patch) | |
tree | 297ace85e4a46164650b305835e6c12635969419 | |
parent | 84f4565e132e469f802fa139820045210aa35ba3 (diff) | |
download | minetest-b539985ab827c2eb025ecb28cf1a97bdd3c75d58.tar.gz minetest-b539985ab827c2eb025ecb28cf1a97bdd3c75d58.tar.bz2 minetest-b539985ab827c2eb025ecb28cf1a97bdd3c75d58.zip |
Fix two nul deref if digging unknown nodes. (#5398)
Introduced by d785456b3fa35faf47cb972fde9e8668382c5e22 (#5162)
-rw-r--r-- | builtin/game/item.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 7048dded1..671a994c7 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -496,7 +496,7 @@ function core.node_dig(pos, node, digger) core.handle_node_drops(pos, drops, digger) local oldmetadata = nil - if def.after_dig_node then + if def and def.after_dig_node then oldmetadata = core.get_meta(pos):to_table() end @@ -504,7 +504,7 @@ function core.node_dig(pos, node, digger) core.remove_node(pos) -- Run callback - if def.after_dig_node then + if def and def.after_dig_node then -- Copy pos and node because callback can modify them local pos_copy = {x=pos.x, y=pos.y, z=pos.z} local node_copy = {name=node.name, param1=node.param1, param2=node.param2} |