Skip to content

Commit 042e267

Browse files
committedDec 13, 2017
Do not search data in case of an invalid feature
1 parent 3f65a9c commit 042e267

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/gui/editorwidgets/qgsrelationreferencewidget.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,14 @@ void QgsRelationReferenceWidget::init()
583583
}
584584
}
585585

586-
QVariant featId = mFeature.isValid() ? mFeature.id() : QVariant( QVariant::Int );
587-
mComboBox->setCurrentIndex( mComboBox->findData( featId, QgsAttributeTableModel::FeatureIdRole ) );
586+
if ( mFeature.isValid() )
587+
{
588+
mComboBox->setCurrentIndex( mComboBox->findData( mFeature.id(), QgsAttributeTableModel::FeatureIdRole ) );
589+
}
590+
else
591+
{
592+
mComboBox->setCurrentIndex( -1 );
593+
}
588594

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

0 commit comments

Comments
 (0)
Please sign in to comment.