Fix spatialite crash on field added

Fixes #34375

Add a check for the field index validity, but the issue was really
an undesired side effect of the spaghetti-signal-slot hell.
This commit is contained in:
Alessandro Pasotti 2020-02-12 16:26:46 +01:00 committed by Nyall Dawson
parent 1c53c7744b
commit 2024fb5683

View File

@ -1024,6 +1024,11 @@ QVariant QgsSpatiaLiteProvider::defaultValue( int fieldId ) const
QString QgsSpatiaLiteProvider::defaultValueClause( int fieldIndex ) const
{
if ( ! mAttributeFields.exists( fieldIndex ) )
{
return QString();
}
if ( mAttributeFields.at( fieldIndex ).name() == mPrimaryKey && mPrimaryKeyAutoIncrement )
{
return tr( "Autogenerate" );