Skip to content

Commit

Permalink
Fix crash due to index on wrong model
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 5, 2018
1 parent 0cd21c9 commit 0cf8a33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/qgslayertreeviewbadlayerindicator.cpp
Expand Up @@ -83,7 +83,7 @@ void QgsLayerTreeViewBadLayerIndicatorProvider::onIndicatorClicked( const QModel
{
if ( index.isValid() )
{
const QgsLayerItem *item = qobject_cast<QgsLayerItem *>( browserModel.dataItem( index ) );
const QgsLayerItem *item = qobject_cast<QgsLayerItem *>( proxyModel.dataItem( index ) );
if ( item && item->mapLayerType() == layerType )
{
return true;
Expand All @@ -103,7 +103,7 @@ void QgsLayerTreeViewBadLayerIndicatorProvider::onIndicatorClicked( const QModel
QModelIndex idx = browserWidget->currentIndex();
if ( isItemCompatible( idx ) )
{
const QgsDataItem *item( browserModel.dataItem( idx ) );
const QgsDataItem *item( proxyModel.dataItem( idx ) );
layer->setDataSource( item->mimeUri().uri, layer->name(), item->mimeUri().providerKey, QgsDataProvider::ProviderOptions() );
// Re-apply style
if ( ! layer->originalXmlProperties().isEmpty() )
Expand Down

0 comments on commit 0cf8a33

Please sign in to comment.