From 07b29ee8730650b5acacdca319218173ad1a34ff Mon Sep 17 00:00:00 2001 From: quadbyte Date: Wed, 13 Aug 2025 08:30:52 -0400 Subject: [PATCH] NComboBox: better safe guards --- Widgets/NComboBox.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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