Skip to content
Permalink
Browse files

Followup 1bdef80: Fix crash when layer not in edit mode

  • Loading branch information
m-kuhn committed Aug 27, 2014
1 parent 1bdef80 commit b3d19d6b65caa167ec2b60849fcf435c637135b7
Showing with 16 additions and 13 deletions.
  1. +16 −13 src/core/qgsvectorlayer.cpp
@@ -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;
}
}
}
}

0 comments on commit b3d19d6

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