Closed aerozoic closed 7 years ago
Confirmed, I just had this same crash on a server.
id = nil
in your crash, assuming those values are the lua function parameters, which looks correct. This would cause the table index to be nil
. Testing shows that table[nil]
returns nil
, so there is somehow an incorrect value passed for id
somewhere.
https://github.com/minetest-mods/xdecor/blob/master/src/workbench.lua#L155
If the player uses keyup
or something like that, none of the fields.craft
etc. are set. Causing nil
to be passed as id
.
Something like this may fix it:
diff --git a/xdecor/src/workbench.lua b/xdecor/src/workbench.lua
index 0df3bf5..80a4c5e 100644
--- a/xdecor/src/workbench.lua
+++ b/xdecor/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)
@sofar Feel free to push it. I don't code for xdecor
anymore.
Yes, I'm verifying my fix later today and will push once I get a chance to test it.
I have no idea what caused this.
:large_orange_diamond: