Skip to content

Commit

Permalink
Few fixes in the attribute table model
Browse files Browse the repository at this point in the history
They were triggering assertions in debug mode...
  • Loading branch information
wonder-sk committed Jun 18, 2014
1 parent 86860ce commit 36988f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent )
: QAbstractTableModel( parent )
, mLayerCache( layerCache )
, mFieldCount( 0 )
, mCachedField( -1 )
{
QgsDebugMsg( "entered." );
Expand Down Expand Up @@ -285,9 +286,12 @@ void QgsAttributeTableModel::loadLayer()
{
QgsDebugMsg( "entered." );

beginRemoveRows( QModelIndex(), 0, rowCount() - 1 );
removeRows( 0, rowCount() );
endRemoveRows();
if ( rowCount() != 0 )
{
beginRemoveRows( QModelIndex(), 0, rowCount() - 1 );
removeRows( 0, rowCount() );
endRemoveRows();
}

QgsFeatureIterator features = mLayerCache->getFeatures( mFeatureRequest );

Expand Down

0 comments on commit 36988f1

Please sign in to comment.