#6 and #7 fixed crash when adding a new dialog and discarding it

This commit is contained in:
Sokomine 2021-05-04 00:28:28 +02:00
parent 038650d90d
commit 76ba4075d1

View File

@ -1908,6 +1908,12 @@ yl_speak_up.save_changes_and_switch_to_other_dialog = function(player, fields, t
yl_speak_up.speak_to[pname].dialog = load_dialog(n_id)
-- clear list of changes
yl_speak_up.npc_was_changed[ n_id ] = {}
-- it is possible that the target dialog was newly added - and just discarded;
-- in such a case stick to the old dialog
local dialog = yl_speak_up.speak_to[pname].dialog
if(not(dialog[target_dialog])) then
target_dialog = yl_speak_up.speak_to[pname].d_id
end
end
-- are there any changes which might be saved or discarded?