Skip to content

Commit e34b88c

Browse files
committed
Fixed #17686
1 parent 42e4c78 commit e34b88c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/netedit/frames/data/GNEGenericDataFrame.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,22 @@ GNEGenericDataFrame::DataSetSelector::refreshDataSetSelector(const GNEDataSet* c
101101
// clear items
102102
myDataSetsComboBox->clearItems();
103103
// declare item index
104-
int currentItemIndex = -1;
104+
int currentDataSetIndex = -1;
105105
// fill myDataSetsComboBox with all DataSets
106106
for (const auto& dataSet : myGenericDataFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDataSets()) {
107107
// check if we have to set currentItemIndex
108-
if ((currentItemIndex == -1) && (dataSet.second == currentDataSet)) {
109-
currentItemIndex = myDataSetsComboBox->getNumItems();
108+
if ((currentDataSetIndex == -1) && (dataSet.second == currentDataSet)) {
109+
currentDataSetIndex = myDataSetsComboBox->getNumItems();
110110
}
111111
myDataSetsComboBox->appendIconItem(dataSet.second->getID().c_str(), dataSet.second->getACIcon());
112112
}
113+
// if in this point, if currentDataSetIndex is not set, then use the first comboBox
114+
if ((currentDataSetIndex == -1) && (myDataSetsComboBox->getNumItems() > 0)) {
115+
currentDataSetIndex = 0;
116+
}
113117
// check if we have to set current element
114-
if (currentItemIndex != -1) {
115-
myDataSetsComboBox->setCurrentItem(currentItemIndex, FALSE);
118+
if (currentDataSetIndex != -1) {
119+
myDataSetsComboBox->setCurrentItem(currentDataSetIndex, FALSE);
116120
if (myGenericDataFrameParent->getIntervalSelector()) {
117121
myGenericDataFrameParent->getIntervalSelector()->enableContents();
118122
}

0 commit comments

Comments
 (0)