fix off-by-one index check

Change-Id: I6d6461eec24895e9aa0e77deccd39210958b7e2c
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Mark Brand 2013-07-01 14:45:37 +02:00 committed by The Qt Project
parent 971bdc90e9
commit 96a22ed926

View File

@ -253,7 +253,7 @@ QVariant QSqlCachedResult::data(int i)
bool QSqlCachedResult::isNull(int i)
{
int idx = d->forwardOnly ? i : at() * d->colCount + i;
if (i > d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd)
if (i >= d->colCount || i < 0 || at() < 0 || idx >= d->rowCacheEnd)
return true;
return d->cache.at(idx).isNull();