diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2018-04-15 19:55:22 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2018-04-15 19:55:22 +0100 |
commit | bfd44443a2df2c393412ef2e86df237e66534b4e (patch) | |
tree | 79e19af995519603a9b4e1a7594279164c039758 | |
parent | cb5530c6c82a4e3409780d93d513dd32c68c4dec (diff) |
wielder.lua: fix crash in can_tool_dig_node() when unknown nodes are looked up
-rw-r--r-- | wielder.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/wielder.lua b/wielder.lua index 51ee278..b92176f 100644 --- a/wielder.lua +++ b/wielder.lua @@ -28,7 +28,11 @@ local can_tool_dig_node = function(nodename, toolcaps, toolname) -- diggable: boolean, can this tool dig this node at all -- time: float, time needed to dig with this tool -- wear: int, number of wear points to inflict on the item - local nodegroups = minetest.registered_nodes[nodename].groups + local nodedef = minetest.registered_nodes[nodename] + -- don't explode due to nil def in event of unknown node! + if (nodedef == nil) then return false end + + local nodegroups = nodedef.groups local diggable = minetest.get_dig_params(nodegroups, toolcaps).diggable if not diggable then -- a pickaxe can't actually dig leaves based on it's groups alone, |