Skip to content

Commit 0cf8a33

Browse files
committedNov 5, 2018
Fix crash due to index on wrong model
1 parent 0cd21c9 commit 0cf8a33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/app/qgslayertreeviewbadlayerindicator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void QgsLayerTreeViewBadLayerIndicatorProvider::onIndicatorClicked( const QModel
8383
{
8484
if ( index.isValid() )
8585
{
86-
const QgsLayerItem *item = qobject_cast<QgsLayerItem *>( browserModel.dataItem( index ) );
86+
const QgsLayerItem *item = qobject_cast<QgsLayerItem *>( proxyModel.dataItem( index ) );
8787
if ( item && item->mapLayerType() == layerType )
8888
{
8989
return true;
@@ -103,7 +103,7 @@ void QgsLayerTreeViewBadLayerIndicatorProvider::onIndicatorClicked( const QModel
103103
QModelIndex idx = browserWidget->currentIndex();
104104
if ( isItemCompatible( idx ) )
105105
{
106-
const QgsDataItem *item( browserModel.dataItem( idx ) );
106+
const QgsDataItem *item( proxyModel.dataItem( idx ) );
107107
layer->setDataSource( item->mimeUri().uri, layer->name(), item->mimeUri().providerKey, QgsDataProvider::ProviderOptions() );
108108
// Re-apply style
109109
if ( ! layer->originalXmlProperties().isEmpty() )

0 commit comments

Comments
 (0)
Please sign in to comment.