@@ -153,13 +153,11 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap ¶meters,
153
153
const QgsProcessingParameterDefinition *distanceParamDef = parameterDefinition ( QStringLiteral ( " DISTANCE" ) );
154
154
155
155
long count = source->featureCount ();
156
- if ( count <= 0 )
157
- return QVariantMap ();
158
156
159
157
QgsFeature f;
160
158
QgsFeatureIterator it = source->getFeatures ();
161
159
162
- double step = 100.0 / count;
160
+ double step = count > 0 ? 100.0 / count : 1 ;
163
161
int current = 0 ;
164
162
165
163
QList< QgsGeometry > bufferedGeometriesForDissolve;
@@ -254,13 +252,11 @@ QVariantMap QgsDissolveAlgorithm::processAlgorithm( const QVariantMap ¶meter
254
252
QStringList fields = parameterAsFields ( parameters, QStringLiteral ( " FIELD" ), context );
255
253
256
254
long count = source->featureCount ();
257
- if ( count <= 0 )
258
- return QVariantMap ();
259
255
260
256
QgsFeature f;
261
257
QgsFeatureIterator it = source->getFeatures ();
262
258
263
- double step = 100.0 / count;
259
+ double step = count > 0 ? 100.0 / count : 1 ;
264
260
int current = 0 ;
265
261
266
262
if ( fields.isEmpty () )
@@ -421,8 +417,11 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap ¶meters, Q
421
417
clipGeoms << f.geometry ();
422
418
}
423
419
420
+ QVariantMap outputs;
421
+ outputs.insert ( QStringLiteral ( " OUTPUT" ), dest );
422
+
424
423
if ( clipGeoms.isEmpty () )
425
- return QVariantMap () ;
424
+ return outputs ;
426
425
427
426
// are we clipping against a single feature? if so, we can show finer progress reports
428
427
bool singleClipFeature = false ;
@@ -522,8 +521,6 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap ¶meters, Q
522
521
}
523
522
}
524
523
525
- QVariantMap outputs;
526
- outputs.insert ( QStringLiteral ( " OUTPUT" ), dest );
527
524
return outputs;
528
525
}
529
526
@@ -655,13 +652,11 @@ QVariantMap QgsMultipartToSinglepartAlgorithm::processAlgorithm( const QVariantM
655
652
return QVariantMap ();
656
653
657
654
long count = source->featureCount ();
658
- if ( count <= 0 )
659
- return QVariantMap ();
660
655
661
656
QgsFeature f;
662
657
QgsFeatureIterator it = source->getFeatures ();
663
658
664
- double step = 100.0 / count;
659
+ double step = count > 0 ? 100.0 / count : 1 ;
665
660
int current = 0 ;
666
661
while ( it.nextFeature ( f ) )
667
662
{
@@ -754,10 +749,8 @@ QVariantMap QgsExtractByExpressionAlgorithm::processAlgorithm( const QVariantMap
754
749
QgsExpressionContext expressionContext = createExpressionContext ( parameters, context );
755
750
756
751
long count = source->featureCount ();
757
- if ( count <= 0 )
758
- return QVariantMap ();
759
752
760
- double step = 100.0 / count;
753
+ double step = count > 0 ? 100.0 / count : 1 ;
761
754
int current = 0 ;
762
755
763
756
if ( !nonMatchingSink )
@@ -953,10 +946,8 @@ QVariantMap QgsExtractByAttributeAlgorithm::processAlgorithm( const QVariantMap
953
946
QgsExpressionContext expressionContext = createExpressionContext ( parameters, context );
954
947
955
948
long count = source->featureCount ();
956
- if ( count <= 0 )
957
- return QVariantMap ();
958
949
959
- double step = 100.0 / count;
950
+ double step = count > 0 ? 100.0 / count : 1 ;
960
951
int current = 0 ;
961
952
962
953
if ( !nonMatchingSink )
@@ -1058,10 +1049,8 @@ QVariantMap QgsRemoveNullGeometryAlgorithm::processAlgorithm( const QVariantMap
1058
1049
std::unique_ptr< QgsFeatureSink > nullSink ( parameterAsSink ( parameters, QStringLiteral ( " NULL_OUTPUT" ), context, nullSinkId, source->fields () ) );
1059
1050
1060
1051
long count = source->featureCount ();
1061
- if ( count <= 0 )
1062
- return QVariantMap ();
1063
1052
1064
- double step = 100.0 / count;
1053
+ double step = count > 0 ? 100.0 / count : 1 ;
1065
1054
int current = 0 ;
1066
1055
1067
1056
QgsFeature f;
0 commit comments