[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kexi] src/widget/tableview: KexiComboBoxBase: Fix integer handling (invalid index possible)
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2016-02-29 23:12:16
Message-ID: E1aaWzA-0000sv-7F () scm ! kde ! org
[Download RAW message or body]
Git commit b2736ab7d2d1d70c1f84ac60237166485dee16ee by Jaroslaw Staniek.
Committed on 29/02/2016 at 23:07.
Pushed by staniek into branch 'master'.
KexiComboBoxBase: Fix integer handling (invalid index possible)
CID #1353938, #1353939
M +5 -1 src/widget/tableview/kexicomboboxbase.cpp
http://commits.kde.org/kexi/b2736ab7d2d1d70c1f84ac60237166485dee16ee
diff --git a/src/widget/tableview/kexicomboboxbase.cpp b/src/widget/tableview/kexicomboboxbase.cpp
index dc08dc7..63ff688 100644
--- a/src/widget/tableview/kexicomboboxbase.cpp
+++ b/src/widget/tableview/kexicomboboxbase.cpp
@@ -75,6 +75,9 @@ int KexiComboBoxBase::recordToHighlightForLookupTable() const
//! @todo for now we're assuming the id is INTEGER
KDbTableViewData *tvData = popup()->tableView()->data();
const int boundColumn = boundColumnIndex();
+ if (boundColumn < 0) {
+ return -1;
+ }
int record = -1;
for (KDbTableViewDataIterator it(tvData->begin()); it != tvData->end(); ++it) {
record++;
@@ -291,7 +294,8 @@ QVariant KexiComboBoxBase::value()
}
data = selectRecordForEnteredValueInLookupTable(m_userEnteredValue);
}
- return data ? data->at(boundColumnIndex()) : QVariant();
+ const int boundColumn = boundColumnIndex();
+ return (data && boundColumn >= 0) ? data->at(boundColumn) : QVariant();
} else if (popup()) {
//use 'enum hints' model
const int record = popup()->tableView()->currentRecord();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic