mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix index-out-of-bounds crash
This commit is contained in:
parent
8b2ea98871
commit
35a2be634b
@ -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 );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user