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)

(cherry picked from commit bdbc358)
  • Loading branch information
alexbruy authored and nyalldawson committed May 28, 2019
1 parent 9a204c4 commit c14c713
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgscolorramp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,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 c14c713

Please sign in to comment.