Skip to content

Commit eae7807

Browse files
author
mhugent
committed
Fix crash in ticket #3528
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15305 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ebd8f12 commit eae7807

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/providers/spatialite/qgsspatialiteprovider.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,12 @@ void QgsSpatiaLiteProvider::uniqueValues( int index, QList < QVariant > &uniqueV
908908
uniqueValues.clear();
909909

910910
// get the field name
911-
const QgsField & fld = field( index );
911+
QgsFieldMap::const_iterator fieldIt = attributeFields.find( index );
912+
if ( fieldIt == attributeFields.constEnd() )
913+
{
914+
return; //invalid field
915+
}
916+
const QgsField& fld = fieldIt.value();
912917

913918
sql = QString( "SELECT DISTINCT %1 FROM %2 ORDER BY %1" ).arg( quotedIdentifier( fld.name() ) ).arg( mQuery );
914919

0 commit comments

Comments
 (0)