Skip to content
Permalink
Browse files

Fix crash with maximumValue/minimumValue for virtual fields

  • Loading branch information
m-kuhn committed Jul 28, 2014
1 parent e5a8749 commit 38d458ce5cd03c0388d6645de76976cccb28292b
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/core/qgsvectorlayer.cpp
@@ -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 );
}
@@ -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() )

0 comments on commit 38d458c

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