show error message instead of crash if no formspec text supplied
This commit is contained in:
parent
6e604b05d0
commit
a54c395e91
@ -35,6 +35,13 @@ end
|
||||
-- show formspec with highest possible version information for the player
|
||||
-- force_version: optional parameter
|
||||
yl_speak_up.show_fs_ver = function(pname, formname, formspec, force_version)
|
||||
-- catch errors
|
||||
if(not(formspec)) then
|
||||
force_version = "1"
|
||||
formspec = "size[4,2]label[0,0;Error: No text found for form\n\""..
|
||||
minetest.formspec_escape(formname).."\"]"..
|
||||
"button_exit[1.5,1.5;1,0.5;exit;Exit]"
|
||||
end
|
||||
-- if the formspec already calls for a specific formspec version: use that one
|
||||
if(string.sub(formspec, 1, 17) == "formspec_version[") then
|
||||
minetest.show_formspec(pname, formname, formspec)
|
||||
|
Loading…
Reference in New Issue
Block a user