Skip to content
Permalink
Browse files

Fixing null pointer on ramp bug

  • Loading branch information
ccrook committed Sep 26, 2014
1 parent 25a7be2 commit b558c08bd48242522b270447b84f8e25a1622e8f
@@ -1301,15 +1301,18 @@ void QgsGraduatedSymbolRendererV2::updateColorRamp( QgsVectorColorRampV2 *ramp,
this->setInvertedColorRamp( inverted );
}

foreach ( QgsRendererRangeV2 range, mRanges )
if( mSourceColorRamp )
{
QgsSymbolV2* symbol = range.symbol()->clone();
double colorValue;
if ( inverted ) colorValue = ( mRanges.count() > 1 ? ( double )( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
else colorValue = ( mRanges.count() > 1 ? ( double ) i / ( mRanges.count() - 1 ) : 0 );
symbol->setColor( mSourceColorRamp->color( colorValue ) );
updateRangeSymbol( i, symbol );
++i;
foreach ( QgsRendererRangeV2 range, mRanges )
{
QgsSymbolV2* symbol = range.symbol()->clone();
double colorValue;
if ( inverted ) colorValue = ( mRanges.count() > 1 ? ( double )( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
else colorValue = ( mRanges.count() > 1 ? ( double ) i / ( mRanges.count() - 1 ) : 0 );
symbol->setColor( mSourceColorRamp->color( colorValue ) );
updateRangeSymbol( i, symbol );
++i;
}
}

}
@@ -581,6 +581,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()

mRenderer->setClassAttribute(attrName);
mRenderer->setMode(mode);
mRenderer->setSourceColorRamp(ramp->clone());
bool updateUiCount=true;
QApplication::setOverrideCursor( Qt::WaitCursor );
mRenderer->updateClasses(mLayer,mode,nclasses);

0 comments on commit b558c08

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