@@ -145,7 +145,6 @@ void QgsFieldCalculator::accept()
145
145
146
146
// go through all the features and change the new attribute
147
147
QgsFeature feature;
148
- bool calculationSuccess = true ;
149
148
150
149
bool onlySelected = ( mOnlyUpdateSelectedCheckBox ->checkState () == Qt::Checked );
151
150
QgsFeatureIds selectedIds = mVectorLayer ->selectedFeaturesIds ();
@@ -173,10 +172,10 @@ void QgsFieldCalculator::accept()
173
172
searchTree->getValue ( value, searchTree, mVectorLayer ->pendingFields (), feature );
174
173
if ( value.isError () )
175
174
{
176
- calculationSuccess = false ;
177
- break ;
175
+ // insert NULL value for this feature and continue the calculation
176
+ mVectorLayer -> changeAttributeValue ( feature. id (), attributeId, QVariant (), false ) ;
178
177
}
179
- if ( value.isNumeric () )
178
+ else if ( value.isNumeric () )
180
179
{
181
180
mVectorLayer ->changeAttributeValue ( feature.id (), attributeId, value.number (), false );
182
181
}
@@ -191,18 +190,6 @@ void QgsFieldCalculator::accept()
191
190
// stop blocking layerModified signals and make sure that one layerModified signal is emitted
192
191
mVectorLayer ->blockSignals ( false );
193
192
mVectorLayer ->setModified ( true , false );
194
-
195
-
196
- if ( !calculationSuccess )
197
- {
198
- QMessageBox::critical ( 0 , tr ( " Error" ), tr ( " An error occured while evaluating the calculation string." ) );
199
-
200
- // remove new attribute
201
- mVectorLayer ->deleteAttribute ( attributeId );
202
- mVectorLayer ->destroyEditCommand ();
203
- return ;
204
- }
205
-
206
193
mVectorLayer ->endEditCommand ();
207
194
}
208
195
QDialog::accept ();
0 commit comments