ODBC: Correctly check if the field is within the fieldCache range

This was found while running the ODBC tests. tst_QSqlQuery::isNull()
accounts for this already.

Change-Id: Idf99a85396d7aa4e69b89467f873b105ef946f7f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Andy Shaw 2018-09-11 19:18:35 +02:00
parent 14bae62bd2
commit c9f316c8b9

View File

@ -1307,7 +1307,7 @@ QVariant QODBCResult::data(int field)
bool QODBCResult::isNull(int field)
{
Q_D(const QODBCResult);
if (field < 0 || field > d->fieldCache.size())
if (field < 0 || field >= d->fieldCache.size())
return true;
if (field <= d->fieldCacheIdx) {
// since there is no good way to find out whether the value is NULL