Skip to content

Commit

Permalink
Do not search data in case of an invalid feature
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Dec 13, 2017
1 parent 3f65a9c commit 042e267
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -583,8 +583,14 @@ void QgsRelationReferenceWidget::init()
}
}

QVariant featId = mFeature.isValid() ? mFeature.id() : QVariant( QVariant::Int );
mComboBox->setCurrentIndex( mComboBox->findData( featId, QgsAttributeTableModel::FeatureIdRole ) );
if ( mFeature.isValid() )
{
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );
}
else
{
mComboBox->setCurrentIndex( -1 );
}

// Only connect after iterating, to have only one iterator on the referenced table at once
connect( mComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( comboReferenceChanged( int ) ) );
Expand Down

0 comments on commit 042e267

Please sign in to comment.