Fix crash when Tab is pressed at the last cell of a view's grid (#1289)

The crash is avoided if the table model is not editable, since insertRows
checks that. A table model for a DB view should be not editable, so this
fix avoids the crash and possibly other possible misbehaviours.
This commit is contained in:
Manuel
2018-01-13 16:27:19 +01:00
committed by Martin Kleusberg
parent b2fbf45012
commit 512b694114
2 changed files with 2 additions and 2 deletions

View File

@@ -938,7 +938,7 @@ void SqliteTableModel::setPseudoPk(const QString& pseudoPk)
bool SqliteTableModel::isEditable() const
{
return !m_sTable.isEmpty();
return !m_sTable.isEmpty() && m_db.getObjectByName(m_sTable)->type() == sqlb::Object::Types::Table;
}
void SqliteTableModel::waitForFetchingFinished()

View File

@@ -64,7 +64,7 @@ public:
// This returns true if the model is set up for editing. The model is able to operate in more or less two different modes, table browsing
// and query browsing. We only support editing data for the table browsing mode and not for the query mode. This function returns true if
// the model is currently editable, i.e. it's running in table mode.
// the model is currently editable, i.e. it's running in table mode and it isn't a view.
bool isEditable() const;
// Helper function for removing all comments from a SQL query