Fix template OptionButton in create script dialog doesn't select the correct template

This commit is contained in:
Jean-Michel Bernard 2022-02-04 19:08:10 +01:00
parent 8495be9cec
commit f86ab4031a

View File

@ -763,10 +763,10 @@ void ScriptCreateDialog::_update_dialog() {
} }
ScriptLanguage::ScriptTemplate ScriptCreateDialog::_get_current_template() const { ScriptLanguage::ScriptTemplate ScriptCreateDialog::_get_current_template() const {
int selected_id = template_menu->get_selected_id(); int selected_index = template_menu->get_selected();
for (const ScriptLanguage::ScriptTemplate &t : template_list) { for (const ScriptLanguage::ScriptTemplate &t : template_list) {
if (is_using_templates) { if (is_using_templates) {
if (t.id == selected_id) { if (t.id == selected_index) {
return t; return t;
} }
} else { } else {