Skip to content
Permalink
Browse files

Fix #10202 (fix crash in graduated symbol renderer)

  • Loading branch information
wonder-sk committed Jun 10, 2014
1 parent a19886d commit ff9356f477fc19307a8f2c4e5b3c9442cc2cb5da
@@ -390,11 +390,15 @@ QList<QString> QgsCategorizedSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;

if ( QgsExpression* exp = QgsSymbolLayerV2Utils::fieldOrExpressionToExpression( mAttrName ) )
{
attributes.unite( exp->referencedColumns().toSet() );
delete exp;
}
// mAttrName can contain either attribute name or an expression.
// Sometimes it is not possible to distinguish between those two,
// e.g. "a - b" can be both a valid attribute name or expression.
// Since we do not have access to fields here, try both options.
attributes << mAttrName;

QgsExpression testExpr( mAttrName );
if ( !testExpr.hasParserError() )
attributes.unite( testExpr.referencedColumns().toSet() );

if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
@@ -265,11 +265,15 @@ QList<QString> QgsGraduatedSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;

if ( QgsExpression* exp = QgsSymbolLayerV2Utils::fieldOrExpressionToExpression( mAttrName ) )
{
attributes.unite( exp->referencedColumns().toSet() );
delete exp;
}
// mAttrName can contain either attribute name or an expression.
// Sometimes it is not possible to distinguish between those two,
// e.g. "a - b" can be both a valid attribute name or expression.
// Since we do not have access to fields here, try both options.
attributes << mAttrName;

QgsExpression testExpr( mAttrName );
if ( !testExpr.hasParserError() )
attributes.unite( testExpr.referencedColumns().toSet() );

if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );

0 comments on commit ff9356f

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