Skip to content
Permalink
Browse files

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 083ebfe32608844ca7992d224b877be6a8c0b575
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/symbology-ng/qgsvectorcolorrampv2.cpp
@@ -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() ) );
@@ -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

0 comments on commit 083ebfe

Please sign in to comment.
You can’t perform that action at this time.