Skip to content

Commit a764bf0

Browse files
author
mhugent
committed
Saver attribute map handling (no insertion of additional entry if a column does not exist)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15388 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8b52395 commit a764bf0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/providers/ogr/qgsogrprovider.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,13 @@ void QgsOgrProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, int
19021902

19031903
QVariant QgsOgrProvider::minimumValue( int index )
19041904
{
1905-
QgsField fld = mAttributeFields[index];
1905+
QgsFieldMap::const_iterator attIt = mAttributeFields.find( index );
1906+
if ( attIt == mAttributeFields.constEnd() )
1907+
{
1908+
return QVariant();
1909+
}
1910+
const QgsField& fld = attIt.value();
1911+
19061912
QString theLayerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) );
19071913

19081914
QString sql = QString( "SELECT MIN(%1) FROM %2" )
@@ -1936,7 +1942,13 @@ QVariant QgsOgrProvider::minimumValue( int index )
19361942

19371943
QVariant QgsOgrProvider::maximumValue( int index )
19381944
{
1939-
QgsField fld = mAttributeFields[index];
1945+
QgsFieldMap::const_iterator attIt = mAttributeFields.find( index );
1946+
if ( attIt == mAttributeFields.constEnd() )
1947+
{
1948+
return QVariant();
1949+
}
1950+
const QgsField& fld = mAttributeFields[index];
1951+
19401952
QString theLayerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrLayer ) );
19411953

19421954
QString sql = QString( "SELECT MAX(%1) FROM %2" )

0 commit comments

Comments
 (0)