Skip to content

Commit 110b87e

Browse files
committedMay 13, 2013
[Fix #7784] Browser keeps crashing when navigating the tree
1 parent b5c540f commit 110b87e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

‎src/gui/attributetable/qgsattributetableview.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel
120120
QTableView::setModel( filterModel );
121121

122122
delete mFeatureSelectionModel;
123-
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFilterModel->layer(), mFilterModel );
124-
setSelectionModel( mFeatureSelectionModel );
125-
mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
126-
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
127-
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
123+
mFeatureSelectionModel = NULL;
124+
125+
if ( filterModel )
126+
{
127+
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFilterModel->layer(), mFilterModel );
128+
setSelectionModel( mFeatureSelectionModel );
129+
mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
130+
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
131+
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
132+
}
128133
}
129134

130135
void QgsAttributeTableView::closeEvent( QCloseEvent *e )

0 commit comments

Comments
 (0)