mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Harden mcl_skins against missing metadata
This commit is contained in:
parent
918c408e4d
commit
a1c0a1f82f
1 changed files with 9 additions and 3 deletions
|
@ -53,6 +53,7 @@ while true do
|
|||
end
|
||||
f = io.open(mcl_skins.modpath .. "/meta/" .. metafile)
|
||||
|
||||
data = nil
|
||||
if f then
|
||||
data = minetest.deserialize("return {" .. f:read('*all') .. "}")
|
||||
f:close()
|
||||
|
@ -199,7 +200,12 @@ minetest.register_chatcommand("setskin", {
|
|||
local skinfile = "#"..skin_id
|
||||
|
||||
local meta = mcl_skins.meta[mcl_skins.skins[playername]]
|
||||
local your_msg = S("Your skin has been set to: @1 (@2)", meta.name, skinfile)
|
||||
local your_msg
|
||||
if not meta.name or meta.name == "" then
|
||||
your_msg = S("Your skin has been set to: @1", skinfile)
|
||||
else
|
||||
your_msg = S("Your skin has been set to: @1 (@2)", meta.name, skinfile)
|
||||
end
|
||||
if name == playername then
|
||||
return true, your_msg
|
||||
else
|
||||
|
@ -252,7 +258,7 @@ mcl_skins.show_formspec = function(playername)
|
|||
formspec = formspec .. "image[0,0;1.35,2.7;" .. mcl_skins.previews[playername] .. ".png]"
|
||||
|
||||
if meta then
|
||||
if meta.name then
|
||||
if meta.name and meta.name ~= "" then
|
||||
formspec = formspec .. "label[2,0.5;" .. minetest.formspec_escape(S("Name: @1", meta.name)) .. "]"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue