From a01d730f3dcf1424ac9d68af850f4fe95db89469 Mon Sep 17 00:00:00 2001 From: quadbyte Date: Wed, 13 Aug 2025 08:21:47 -0400 Subject: [PATCH] NComBox: added safe guards if not options or invalid option index --- Widgets/NComboBox.qml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Widgets/NComboBox.qml b/Widgets/NComboBox.qml index 7219391..1950f0e 100644 --- a/Widgets/NComboBox.qml +++ b/Widgets/NComboBox.qml @@ -69,9 +69,7 @@ ColumnLayout { font.pointSize: Style.fontSizeMedium * scaling verticalAlignment: Text.AlignVCenter elide: Text.ElideRight - text: { - return root.optionsLabels[combo.currentIndex] - } + text: (combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : ""; } // Drop down indicator @@ -110,9 +108,7 @@ ColumnLayout { highlighted: combo.highlightedIndex === index contentItem: NText { - text: { - return root.optionsLabels[combo.model.indexOf(modelData)] - } + text: (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