Skip to content

Commit

Permalink
set default legend raster icon when wms layer to avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Oct 5, 2017
1 parent 82dcc68 commit b3ea17f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -227,6 +227,8 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( testFlag( ShowRasterPreviewIcon ) )
{
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( layer );
if ( rlayer->providerType() == "wms" )
return QgsLayerItem::iconRaster();
return QIcon( QPixmap::fromImage( rlayer->previewAsImage( QSize( 32, 32 ) ) ) );
}
else
Expand Down

0 comments on commit b3ea17f

Please sign in to comment.