Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash in relation reference widget (fix #14732)
(cherry-picked from eed4ee)
  • Loading branch information
nyalldawson committed Apr 26, 2016
1 parent 68cfed9 commit c799812
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -351,7 +351,11 @@ QVariant QgsRelationReferenceWidget::foreignKey()
}
else
{
if ( !mFeature.isValid() )
if ( mReferencingFieldIdx < 0 || mReferencingFieldIdx >= mReferencingLayer->fields().count() )
{
return QVariant();
}
else if ( !mFeature.isValid() )
{
return QVariant( mReferencingLayer->fields().at( mReferencingFieldIdx ).type() );
}
Expand Down

0 comments on commit c799812

Please sign in to comment.