From c495524fbcb6a288bef71d4fff041e1d9b69da4e Mon Sep 17 00:00:00 2001 From: Peinthor Rene Date: Fri, 9 May 2014 17:41:00 +0200 Subject: [PATCH] fix a crash with browsing VIRTUAL tables, that we can't query --- src/sqlitetablemodel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index d130f727..38b3cda7 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -193,7 +193,13 @@ QVariant SqliteTableModel::headerData(int section, Qt::Orientation orientation, return QVariant(); if (orientation == Qt::Horizontal) - return m_headers.at(section); + { + // if we have a VIRTUAL table the model will not be valid, with no header data + if(section < m_headers.size()) + return m_headers.at(section); + + return QString("%1").arg(section + 1); + } else return QString("%1").arg(section + 1); }