Skip to content
Permalink
Browse files

Fix index-out-of-bounds crash

  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent 8b2ea98 commit 35a2be634bc9db767c030593e0adebdb4f4809c6
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
@@ -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 );
}

0 comments on commit 35a2be6

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