Skip to content

Commit

Permalink
Fix crash with legend creation of raster singleband pseudocolor renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Dec 18, 2020
1 parent 2787545 commit d6e2cd0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/raster/qgssinglebandpseudocolorrenderer.cpp
Expand Up @@ -441,6 +441,17 @@ QList<QgsLayerTreeModelLegendNode *> QgsSingleBandPseudoColorRenderer::createLeg
res << new QgsSimpleLegendNode( nodeLayer, name );
}

if ( !rampShader->sourceColorRamp() )
{
const QList< QPair< QString, QColor > > items = legendSymbologyItems();
res.reserve( items.size() );
for ( const QPair< QString, QColor > &item : items )
{
res << new QgsRasterSymbolLegendNode( nodeLayer, item.second, item.first );
}
return res;
}

switch ( rampShader->colorRampType() )
{
case QgsColorRampShader::Interpolated:
Expand Down

0 comments on commit d6e2cd0

Please sign in to comment.