Skip to content

Commit

Permalink
prevent crash in the color brewer color ramp when requested color
Browse files Browse the repository at this point in the history
corresponding to the NaN value (fix #29509)
  • Loading branch information
alexbruy authored and nyalldawson committed May 27, 2019
1 parent 06ab26a commit bdbc358
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgscolorramp.cpp
Expand Up @@ -552,7 +552,7 @@ double QgsColorBrewerColorRamp::value( int index ) const

QColor QgsColorBrewerColorRamp::color( double value ) const
{
if ( mPalette.isEmpty() || value < 0 || value > 1 )
if ( mPalette.isEmpty() || value < 0 || value > 1 || std::isnan( value ) )
return QColor();

int paletteEntry = static_cast< int >( value * mPalette.count() );
Expand Down

0 comments on commit bdbc358

Please sign in to comment.