summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-12-14 16:19:07 +0100
committerWuzzy <almikes@aol.com>2016-12-14 16:19:07 +0100
commite4bb77dc56575c21468da927bf3a74316726266a (patch)
treefd639758b3a3ec237c212d6a94cd6a5774a5c3d2
parent38710369567a409dfeabaaada700095316de4a1e (diff)
Fail gracefully if node has invalid sounds
-rw-r--r--init.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index e928737..bac2d6e 100644
--- a/init.lua
+++ b/init.lua
@@ -475,7 +475,7 @@ doc.new_category("nodes", {
---- Sounds
local function is_silent(def, soundtype)
- return def.sounds == nil or def.sounds[soundtype] == nil or def.sounds[soundtype] == "" or (type(data.def.sounds[soundtype]) == "table" and (data.def.sounds[soundtype].name == nil or data.def.sounds[soundtype].name == ""))
+ return type(def.sounds) ~= "table" or def.sounds[soundtype] == nil or def.sounds[soundtype] == "" or (type(data.def.sounds[soundtype]) == "table" and (data.def.sounds[soundtype].name == nil or data.def.sounds[soundtype].name == ""))
end
local silentstep, silentdig, silentplace = false, false, false
if data.def.walkable and is_silent(data.def, "footstep") then