Skip to content

Commit

Permalink
Fix crash with maximumValue/minimumValue for virtual fields
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jul 28, 2014
1 parent e5a8749 commit 38d458c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2882,7 +2882,11 @@ QVariant QgsVectorLayer::minimumValue( int index )
else if ( origin == QgsFields::OriginEdit || origin == QgsFields::OriginExpression )
{
// the layer is editable, but in certain cases it can still be avoided going through all features
if ( mEditBuffer->mDeletedFeatureIds.isEmpty() && mEditBuffer->mAddedFeatures.isEmpty() && !mEditBuffer->mDeletedAttributeIds.contains( index ) && mEditBuffer->mChangedAttributeValues.isEmpty() )
if ( origin == QgsFields::OriginEdit &&
mEditBuffer->mDeletedFeatureIds.isEmpty() &&
mEditBuffer->mAddedFeatures.isEmpty() && !
mEditBuffer->mDeletedAttributeIds.contains( index ) &&
mEditBuffer->mChangedAttributeValues.isEmpty() )
{
return mDataProvider->minimumValue( index );
}
Expand Down Expand Up @@ -2937,10 +2941,11 @@ QVariant QgsVectorLayer::maximumValue( int index )

return vl->maximumValue( sourceLayerIndex );
}
else if ( origin == QgsFields::OriginEdit )
else if ( origin == QgsFields::OriginEdit || origin == QgsFields::OriginExpression )
{
// the layer is editable, but in certain cases it can still be avoided going through all features
if ( mEditBuffer->mDeletedFeatureIds.isEmpty() &&
if ( origin == QgsFields::OriginEdit &&
mEditBuffer->mDeletedFeatureIds.isEmpty() &&
mEditBuffer->mAddedFeatures.isEmpty() &&
!mEditBuffer->mDeletedAttributeIds.contains( index ) &&
mEditBuffer->mChangedAttributeValues.isEmpty() )
Expand Down

0 comments on commit 38d458c

Please sign in to comment.