fixed #4982 nil value in position

This commit is contained in:
Sokomine 2023-07-22 17:22:46 +02:00
parent ce4909424d
commit 824d69c896

View File

@ -272,6 +272,12 @@ yl_speak_up.build_cache_general_npc_list_lines = function()
priv_list = priv_list..tostring(short_priv_name[priv])..' '
end
end
-- fallback if something went wrong with the position (or it's unknown)
local pos_str = '- unknown -'
if(not(data.pos) or not(data.pos.x) or not(data.pos.y) or not(data.pos.z)) then
pos = {x=0, y=0, z=0}
end
pos_str = minetest.formspec_escape(minetest.pos_to_string(data.pos))
yl_speak_up.cache_general_npc_list_lines[k] = {
id = k, -- keep for sorting
@ -286,7 +292,7 @@ yl_speak_up.build_cache_general_npc_list_lines = function()
anz_trades = show_if_bigger_null(#data.trades),
anz_properties = show_if_bigger_null(data.properties, true),
anz_editors = show_if_bigger_null(data.may_edit, true),
pos = minetest.formspec_escape(minetest.pos_to_string(data.pos)),
pos = pos_str,
priv_list = priv_list,
}
end