tablemodel: fix crash if rowdata couldn't be fetched

This commit is contained in:
Peinthor Rene
2014-08-22 23:13:39 +02:00
parent beae69296c
commit 3b907df8e3
2 changed files with 8 additions and 4 deletions

View File

@@ -321,10 +321,12 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
// update column with default values
QByteArrayList rowdata;
m_db->getRow(m_sTable, rowid, rowdata);
for(int j=1; j < m_headers.size(); ++j)
if( m_db->getRow(m_sTable, rowid, rowdata) )
{
m_data[i].replace(j, rowdata[j - 1]);
for(int j=1; j < m_headers.size(); ++j)
{
m_data[i].replace(j, rowdata[j - 1]);
}
}
}