mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Followup 1bdef80: Fix crash when layer not in edit mode
This commit is contained in:
parent
1bdef80ef4
commit
b3d19d6b65
@ -2821,22 +2821,25 @@ void QgsVectorLayer::uniqueValues( int index, QList<QVariant> &uniqueValues, int
|
||||
{
|
||||
mDataProvider->uniqueValues( index, uniqueValues, limit );
|
||||
|
||||
QSet<QString> vals;
|
||||
Q_FOREACH( const QVariant& v, uniqueValues )
|
||||
vals << v.toString();
|
||||
|
||||
QMapIterator< QgsFeatureId, QgsAttributeMap > it ( mEditBuffer->changedAttributeValues() );
|
||||
while ( it.hasNext() && ( limit < 0 || uniqueValues.count() < limit ) )
|
||||
if ( mEditBuffer )
|
||||
{
|
||||
it.next();
|
||||
QVariant v = it.value().value( index );
|
||||
if ( v.isValid() )
|
||||
QSet<QString> vals;
|
||||
Q_FOREACH( const QVariant& v, uniqueValues )
|
||||
vals << v.toString();
|
||||
|
||||
QMapIterator< QgsFeatureId, QgsAttributeMap > it ( mEditBuffer->changedAttributeValues() );
|
||||
while ( it.hasNext() && ( limit < 0 || uniqueValues.count() < limit ) )
|
||||
{
|
||||
QString vs = v.toString();
|
||||
if ( !vals.contains( vs ) )
|
||||
it.next();
|
||||
QVariant v = it.value().value( index );
|
||||
if ( v.isValid() )
|
||||
{
|
||||
vals << vs;
|
||||
uniqueValues << v;
|
||||
QString vs = v.toString();
|
||||
if ( !vals.contains( vs ) )
|
||||
{
|
||||
vals << vs;
|
||||
uniqueValues << v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user