diff --git a/src/app/qgsfieldcalculator.cpp b/src/app/qgsfieldcalculator.cpp index f8ceee4bf8f4..8956d6993b13 100644 --- a/src/app/qgsfieldcalculator.cpp +++ b/src/app/qgsfieldcalculator.cpp @@ -145,7 +145,6 @@ void QgsFieldCalculator::accept() //go through all the features and change the new attribute QgsFeature feature; - bool calculationSuccess = true; bool onlySelected = ( mOnlyUpdateSelectedCheckBox->checkState() == Qt::Checked ); QgsFeatureIds selectedIds = mVectorLayer->selectedFeaturesIds(); @@ -173,10 +172,10 @@ void QgsFieldCalculator::accept() searchTree->getValue( value, searchTree, mVectorLayer->pendingFields(), feature ); if ( value.isError() ) { - calculationSuccess = false; - break; + //insert NULL value for this feature and continue the calculation + mVectorLayer->changeAttributeValue( feature.id(), attributeId, QVariant(), false ); } - if ( value.isNumeric() ) + else if ( value.isNumeric() ) { mVectorLayer->changeAttributeValue( feature.id(), attributeId, value.number(), false ); } @@ -191,18 +190,6 @@ void QgsFieldCalculator::accept() // stop blocking layerModified signals and make sure that one layerModified signal is emitted mVectorLayer->blockSignals( false ); mVectorLayer->setModified( true, false ); - - - if ( !calculationSuccess ) - { - QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string." ) ); - - //remove new attribute - mVectorLayer->deleteAttribute( attributeId ); - mVectorLayer->destroyEditCommand(); - return; - } - mVectorLayer->endEditCommand(); } QDialog::accept();