Commit fc7ce7f0 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

JsonFieldPage: Be more paranoid with the index of ComboBoxes



This avoids a combobox being shown without any selection. This has
the side-effect that QTCREATORBUG-14699 can no longer get triggered.

Task-number: QTCREATORBUG-14699
Change-Id: I98f5ae503d29370ad46c6620238bc2815c024747
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 554700e0
...@@ -820,13 +820,15 @@ void JsonFieldPage::ComboBoxField::initializeData(MacroExpander *expander) ...@@ -820,13 +820,15 @@ void JsonFieldPage::ComboBoxField::initializeData(MacroExpander *expander)
if (!tmpConditions.at(i)) { if (!tmpConditions.at(i)) {
tmpItems.removeAt(i); tmpItems.removeAt(i);
tmpData.removeAt(i); tmpData.removeAt(i);
if (i <= index) if (i < index && index > 0)
--index; --index;
} }
} }
if (index < 0 || index >= tmpData.count())
index = 0;
w->setItems(tmpItems, tmpData); w->setItems(tmpItems, tmpData);
w->setInsertPolicy(QComboBox::NoInsert); w->setInsertPolicy(QComboBox::NoInsert);
w->setCurrentIndex(index); w->setCurrentIndex(index);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment