diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index f62f05d0bf6..3f798035cde 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -820,13 +820,15 @@ void JsonFieldPage::ComboBoxField::initializeData(MacroExpander *expander) if (!tmpConditions.at(i)) { tmpItems.removeAt(i); tmpData.removeAt(i); - if (i <= index) + if (i < index && index > 0) --index; } } + + if (index < 0 || index >= tmpData.count()) + index = 0; w->setItems(tmpItems, tmpData); w->setInsertPolicy(QComboBox::NoInsert); - w->setCurrentIndex(index); }