Skip to content
Permalink
Browse files

Merge pull request #37105 from m-kuhn/safety_guard_attribute_alias

Add safety guard for DD attribute alias
  • Loading branch information
elpaso committed Jun 10, 2020
2 parents 7d58502 + 7cb484c commit 13bd84640e1ede8825c3a2e0096a3539fd55b7c5
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/gui/qgsattributeform.cpp
@@ -1485,13 +1485,17 @@ void QgsAttributeForm::init()
if ( widgDef->type() == QgsAttributeEditorElement::AttributeEditorType::AeTypeField )
{
const QgsAttributeEditorField *fieldElement { static_cast<QgsAttributeEditorField *>( widgDef ) };
const QString fieldName { mLayer->fields().at( fieldElement->idx() ).name() };
if ( mLayer->editFormConfig().dataDefinedFieldProperties( fieldName ).hasProperty( QgsEditFormConfig::DataDefinedProperty::Alias ) )
const int fieldIdx = fieldElement->idx();
if ( fieldIdx >= 0 && fieldIdx < mLayer->fields().count() )
{
const QgsProperty property { mLayer->editFormConfig().dataDefinedFieldProperties( fieldName ).property( QgsEditFormConfig::DataDefinedProperty::Alias ) };
if ( property.isActive() && ! property.expressionString().isEmpty() )
const QString fieldName { mLayer->fields().at( fieldIdx ).name() };
if ( mLayer->editFormConfig().dataDefinedFieldProperties( fieldName ).hasProperty( QgsEditFormConfig::DataDefinedProperty::Alias ) )
{
mLabelDataDefinedProperties[ label ] = property;
const QgsProperty property { mLayer->editFormConfig().dataDefinedFieldProperties( fieldName ).property( QgsEditFormConfig::DataDefinedProperty::Alias ) };
if ( property.isActive() && ! property.expressionString().isEmpty() )
{
mLabelDataDefinedProperties[ label ] = property;
}
}
}
}

0 comments on commit 13bd846

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