fixed crash attempt to index field 'd_options' #13

This commit is contained in:
Sokomine 2022-01-18 22:40:58 +01:00
parent d0e7b23127
commit 212809d380

View File

@ -160,18 +160,18 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id, calle
local pname = player:get_player_name()
local dialog = yl_speak_up.speak_to[pname].dialog
local n_dialog = dialog.n_dialogs[d_id]
local d_option = n_dialog.d_options[o_id]
-- currently no trade running (we're editing options)
yl_speak_up.trade[pname] = nil
yl_speak_up.speak_to[pname].trade_id = nil
if(not(d_option)) then
if(not(n_dialog.d_options) or not(n_dialog.d_options[o_id])) then
return "size[6,2]"..
"label[0.2,0.5;Ups! Option "..minetest.formspec_escape(tostring(o_id))..
" does not exist.]"..
"button_exit[2,1.5;1,0.9;exit;Exit]"
end
local d_option = n_dialog.d_options[o_id]
-- offer the correct preselection for hidden/grey/show text
local alternate_answer_option = "3"