Skip to content

Commit

Permalink
Fix index-out-of-bounds crash
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent 8b2ea98 commit 35a2be6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,16 @@ QgsEditorWidgetRegistry::~QgsEditorWidgetRegistry()

QgsEditorWidgetSetup QgsEditorWidgetRegistry::findBest( const QgsVectorLayer* vl, const QString& fieldName ) const
{
QgsEditorWidgetSetup setup = vl->fields().field( fieldName ).editorWidgetSetup();
if ( !setup.isNull() )
QgsFields fields = vl->fields();
int index = fields.indexOf( fieldName );

if ( index > -1 )
{
return setup;
QgsEditorWidgetSetup setup = vl->fields().at( index ).editorWidgetSetup();
if ( !setup.isNull() )
return setup;
}

return mAutoConf.editorWidgetSetup( vl, fieldName );
}

Expand Down

0 comments on commit 35a2be6

Please sign in to comment.