summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqlquerymodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/models/qsqlquerymodel.cpp')
-rw-r--r--src/sql/models/qsqlquerymodel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 341804f1ae..fefb87dcf5 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -591,7 +591,8 @@ QModelIndex QSqlQueryModel::indexInQuery(const QModelIndex &item) const
{
Q_D(const QSqlQueryModel);
if (item.column() < 0 || item.column() >= d->rec.count()
- || !d->rec.isGenerated(item.column()))
+ || !d->rec.isGenerated(item.column())
+ || item.column() >= d->colOffsets.size())
return QModelIndex();
return createIndex(item.row(), item.column() - d->colOffsets[item.column()],
item.internalPointer());