Fix crash when error()ing an invalid value

See #337 for details.
This commit is contained in:
number Zero 2017-05-08 17:33:05 +03:00
parent f9ebbdc0fb
commit 564bdc2d9b

@ -478,7 +478,7 @@ local function reset_meta(pos, code, errmsg)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("code", code) meta:set_string("code", code)
code = minetest.formspec_escape(code or "") code = minetest.formspec_escape(code or "")
errmsg = minetest.formspec_escape(errmsg or "") errmsg = minetest.formspec_escape(tostring(errmsg or ""))
meta:set_string("formspec", "size[12,10]".. meta:set_string("formspec", "size[12,10]"..
"background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]".. "background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"..
"textarea[0.2,0.2;12.2,9.5;code;;"..code.."]".. "textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"..