From b06ae63e8f509d7ea451f9b530f2cbee21e7abdd Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 18 Apr 2023 14:53:23 +0200 Subject: [PATCH] QComboBox: don't call index(-1, 0) on the underlying model This is invalid and might assert in the model (e.g. in QConcatenateTablesProxyModel) Pick-to: 6.5 6.2 Change-Id: I6602d8b9eca83ef6cae760944a999d55244bb181 Reviewed-by: Volker Hilsheimer --- src/widgets/widgets/qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index b28bd154c3..fabd4e9eed 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2098,7 +2098,7 @@ int QComboBox::currentIndex() const void QComboBox::setCurrentIndex(int index) { Q_D(QComboBox); - QModelIndex mi = d->model->index(index, d->modelColumn, d->root); + QModelIndex mi = index >= 0 ? d->model->index(index, d->modelColumn, d->root) : QModelIndex(); d->setCurrentIndex(mi); }