diff --git a/Widgets/NComboBox.qml b/Widgets/NComboBox.qml index 1950f0e..e34e9f0 100644 --- a/Widgets/NComboBox.qml +++ b/Widgets/NComboBox.qml @@ -69,7 +69,8 @@ ColumnLayout { font.pointSize: Style.fontSizeMedium * scaling verticalAlignment: Text.AlignVCenter elide: Text.ElideRight - text: (combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : ""; + text: (combo.currentIndex >= 0 + && combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : "" } // Drop down indicator @@ -108,7 +109,8 @@ ColumnLayout { highlighted: combo.highlightedIndex === index contentItem: NText { - text: (combo.model.indexOf(modelData)< root.optionsLabels.length) ? root.optionsLabels[combo.model.indexOf(modelData)] : "" + text: (combo.model.indexOf(modelData) >= 0 && combo.model.indexOf( + modelData) < root.optionsLabels.length) ? root.optionsLabels[combo.model.indexOf(modelData)] : "" font.pointSize: Style.fontSizeMedium * scaling color: highlighted ? Colors.backgroundPrimary : Colors.textPrimary verticalAlignment: Text.AlignVCenter