Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1627 from slarosa/categorized_style_crash
Fix crash when choosing a null field for categorized style
  • Loading branch information
NathanW2 committed Oct 13, 2014
2 parents 4d72d72 + 3d2747c commit 083ebfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsvectorcolorrampv2.cpp
Expand Up @@ -30,6 +30,7 @@

static QColor _interpolate( QColor c1, QColor c2, double value )
{
if ( isnan( value ) ) value = 1;
int r = ( int )( c1.red() + value * ( c2.red() - c1.red() ) );
int g = ( int )( c1.green() + value * ( c2.green() - c1.green() ) );
int b = ( int )( c1.blue() + value * ( c2.blue() - c1.blue() ) );
Expand Down Expand Up @@ -365,11 +366,10 @@ double QgsRandomColorsV2::value( int index ) const

QColor QgsRandomColorsV2::color( double value ) const
{
Q_UNUSED( value );
int minVal = 130;
int maxVal = 255;

int colorIndex = value * ( mTotalColorCount - 1 );
int colorIndex = !isnan( value ) ? value : 1 * ( mTotalColorCount - 1 );
if ( mTotalColorCount >= 1 && mPrecalculatedColors.length() > colorIndex )
{
//use precalculated hue
Expand Down

0 comments on commit 083ebfe

Please sign in to comment.