From: Auke Kok Date: Fri, 10 Nov 2017 05:50:29 +0000 (-0800) Subject: Fix #86 - crash in workbench: `attempt to concatenate a nil value` X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=6b71509f980713f74d6b364cc06b159c1454e114;p=xdecor.git Fix #86 - crash in workbench: `attempt to concatenate a nil value` Caused by a keystroke used in the formspec - this causes all these fields not to be set, and the subsequent crash. --- diff --git a/src/workbench.lua b/src/workbench.lua index 0df3bf5..80a4c5e 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -150,9 +150,11 @@ end function workbench.fields(pos, _, fields) if fields.quit then return end local meta = minetest.get_meta(pos) - workbench:set_formspec(meta, fields.back and 1 or - fields.craft and 2 or - fields.storage and 3) + local id = fields.back and 1 or + fields.craft and 2 or + fields.storage and 3 + if not id then return end + workbench:set_formspec(meta, id) end function workbench.dig(pos)