From e4bb77dc56575c21468da927bf3a74316726266a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 14 Dec 2016 16:19:07 +0100 Subject: Fail gracefully if node has invalid sounds --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3