File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 35
35
QgsAttributeTableModel::QgsAttributeTableModel ( QgsVectorLayerCache *layerCache, QObject *parent )
36
36
: QAbstractTableModel( parent )
37
37
, mLayerCache( layerCache )
38
+ , mFieldCount( 0 )
38
39
, mCachedField( -1 )
39
40
{
40
41
QgsDebugMsg ( " entered." );
@@ -285,9 +286,12 @@ void QgsAttributeTableModel::loadLayer()
285
286
{
286
287
QgsDebugMsg ( " entered." );
287
288
288
- beginRemoveRows ( QModelIndex (), 0 , rowCount () - 1 );
289
- removeRows ( 0 , rowCount () );
290
- endRemoveRows ();
289
+ if ( rowCount () != 0 )
290
+ {
291
+ beginRemoveRows ( QModelIndex (), 0 , rowCount () - 1 );
292
+ removeRows ( 0 , rowCount () );
293
+ endRemoveRows ();
294
+ }
291
295
292
296
QgsFeatureIterator features = mLayerCache ->getFeatures ( mFeatureRequest );
293
297
You can’t perform that action at this time.
0 commit comments