Skip to content
Permalink
Browse files
Processing algorithms: check addFeature() return value to throw excep…
…tion when it fails
  • Loading branch information
rouault authored and nyalldawson committed Jul 21, 2021
1 parent da41d49 commit 96f2cdb777c4448e8fa558b98da2dfcc982a4daf
Showing with 279 additions and 130 deletions.
  1. +6 −3 src/analysis/processing/qgsalgorithmaggregate.cpp
  2. +6 −3 src/analysis/processing/qgsalgorithmangletonearest.cpp
  3. +6 −2 src/analysis/processing/qgsalgorithmbuffer.cpp
  4. +2 −1 src/analysis/processing/qgsalgorithmcalculateoverlaps.cpp
  5. +4 −2 src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp
  6. +2 −1 src/analysis/processing/qgsalgorithmclip.cpp
  7. +2 −1 src/analysis/processing/qgsalgorithmdbscanclustering.cpp
  8. +2 −1 src/analysis/processing/qgsalgorithmdeleteduplicategeometries.cpp
  9. +10 −3 src/analysis/processing/qgsalgorithmdetectdatasetchanges.cpp
  10. +4 −2 src/analysis/processing/qgsalgorithmdissolve.cpp
  11. +2 −1 src/analysis/processing/qgsalgorithmexplodehstore.cpp
  12. +2 −1 src/analysis/processing/qgsalgorithmexportlayersinformation.cpp
  13. +2 −1 src/analysis/processing/qgsalgorithmexportmesh.cpp
  14. +2 −1 src/analysis/processing/qgsalgorithmextentfromlayer.cpp
  15. +2 −1 src/analysis/processing/qgsalgorithmextenttolayer.cpp
  16. +6 −3 src/analysis/processing/qgsalgorithmextractbyattribute.cpp
  17. +6 −3 src/analysis/processing/qgsalgorithmextractbyexpression.cpp
  18. +2 −1 src/analysis/processing/qgsalgorithmextractbyextent.cpp
  19. +2 −1 src/analysis/processing/qgsalgorithmextractbylocation.cpp
  20. +4 −1 src/analysis/processing/qgsalgorithmextractlayoutmapextent.cpp
  21. +2 −1 src/analysis/processing/qgsalgorithmfilter.cpp
  22. +8 −4 src/analysis/processing/qgsalgorithmfilterbygeometry.cpp
  23. +2 −1 src/analysis/processing/qgsalgorithmflattenrelationships.cpp
  24. +12 −6 src/analysis/processing/qgsalgorithmgrid.cpp
  25. +5 −3 src/analysis/processing/qgsalgorithmimportphotos.cpp
  26. +6 −3 src/analysis/processing/qgsalgorithmjoinbyattribute.cpp
  27. +24 −9 src/analysis/processing/qgsalgorithmjoinbylocation.cpp
  28. +10 −5 src/analysis/processing/qgsalgorithmjoinbynearest.cpp
  29. +2 −1 src/analysis/processing/qgsalgorithmjoinwithlines.cpp
  30. +2 −1 src/analysis/processing/qgsalgorithmkmeansclustering.cpp
  31. +2 −1 src/analysis/processing/qgsalgorithmlineintersection.cpp
  32. +2 −1 src/analysis/processing/qgsalgorithmmeancoordinates.cpp
  33. +2 −1 src/analysis/processing/qgsalgorithmmergevector.cpp
  34. +2 −1 src/analysis/processing/qgsalgorithmorderbyexpression.cpp
  35. +2 −1 src/analysis/processing/qgsalgorithmpixelcentroidsfrompolygons.cpp
  36. +2 −1 src/analysis/processing/qgsalgorithmpointslayerfromtable.cpp
  37. +2 −1 src/analysis/processing/qgsalgorithmpointstopaths.cpp
  38. +2 −1 src/analysis/processing/qgsalgorithmpointtolayer.cpp
  39. +2 −1 src/analysis/processing/qgsalgorithmpolygonize.cpp
  40. +2 −1 src/analysis/processing/qgsalgorithmrandomextract.cpp
  41. +5 −3 src/analysis/processing/qgsalgorithmrandompointsextent.cpp
  42. +8 −4 src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp
  43. +6 −3 src/analysis/processing/qgsalgorithmrandompointsonlines.cpp
  44. +2 −1 src/analysis/processing/qgsalgorithmrasterlayeruniquevalues.cpp
  45. +6 −3 src/analysis/processing/qgsalgorithmrastersampling.cpp
  46. +2 −1 src/analysis/processing/qgsalgorithmrastersurfacevolume.cpp
  47. +2 −1 src/analysis/processing/qgsalgorithmrasterzonalstats.cpp
  48. +6 −2 src/analysis/processing/qgsalgorithmremoveduplicatesbyattribute.cpp
  49. +4 −2 src/analysis/processing/qgsalgorithmremovenullgeometry.cpp
  50. +2 −1 src/analysis/processing/qgsalgorithmsavefeatures.cpp
  51. +2 −1 src/analysis/processing/qgsalgorithmsaveselectedfeatures.cpp
  52. +8 −4 src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp
  53. +8 −4 src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp
  54. +4 −2 src/analysis/processing/qgsalgorithmshortestpathlayertopoint.cpp
  55. +4 −2 src/analysis/processing/qgsalgorithmshortestpathpointtolayer.cpp
  56. +2 −1 src/analysis/processing/qgsalgorithmshortestpathpointtopoint.cpp
  57. +8 −4 src/analysis/processing/qgsalgorithmsnapgeometries.cpp
  58. +2 −1 src/analysis/processing/qgsalgorithmsplitvectorlayer.cpp
  59. +4 −2 src/analysis/processing/qgsalgorithmsplitwithlines.cpp
  60. +2 −1 src/analysis/processing/qgsalgorithmtransect.cpp
  61. +4 −2 src/analysis/processing/qgsalgorithmuniquevalueindex.cpp
  62. +2 −1 src/analysis/processing/qgsalgorithmvectorize.cpp
  63. +2 −1 src/analysis/processing/qgsalgorithmzonalhistogram.cpp
  64. +2 −1 src/analysis/processing/qgsbookmarkalgorithms.cpp
  65. +15 −5 src/analysis/processing/qgsoverlayutils.cpp
@@ -173,7 +173,8 @@ QVariantMap QgsAggregateAlgorithm::processAlgorithm( const QVariantMap &paramete
mSource->wkbType(),
mSource->sourceCrs() ) );

sink->addFeature( feature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( feature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QString() ) );

QgsMapLayer *layer = QgsProcessingUtils::mapLayerFromString( id, context );

@@ -189,7 +190,8 @@ QVariantMap QgsAggregateAlgorithm::processAlgorithm( const QVariantMap &paramete
}
else
{
groupIt->sink->addFeature( feature, QgsFeatureSink::FastInsert );
if ( !groupIt->sink->addFeature( feature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( groupIt->sink, parameters, QString() ) );
groupIt->lastFeature = feature;
}

@@ -266,7 +268,8 @@ QVariantMap QgsAggregateAlgorithm::processAlgorithm( const QVariantMap &paramete
QgsFeature outFeat;
outFeat.setGeometry( geometry );
outFeat.setAttributes( attributes );
sink->addFeature( outFeat, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outFeat, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

current++;
feedback->setProgress( 50 + current * progressStep );
@@ -245,7 +245,8 @@ QVariantMap QgsAngleToNearestAlgorithm::processAlgorithm( const QVariantMap &par
else
attributes[ fieldIndex ] = QVariant();
f.setAttributes( attributes );
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
else
{
@@ -258,7 +259,8 @@ QVariantMap QgsAngleToNearestAlgorithm::processAlgorithm( const QVariantMap &par
else
attributes[ fieldIndex ] = QVariant();
f.setAttributes( attributes );
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
else
{
@@ -283,7 +285,8 @@ QVariantMap QgsAngleToNearestAlgorithm::processAlgorithm( const QVariantMap &par
attributes[ fieldIndex ] = QVariant();
}
f.setAttributes( attributes );
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
}
}
@@ -152,7 +152,10 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
}

if ( !dissolve )
sink->addFeature( out, QgsFeatureSink::FastInsert );
{
if ( !sink->addFeature( out, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

feedback->setProgress( current * step );
current++;
@@ -165,7 +168,8 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
QgsFeature f;
f.setGeometry( finalGeometry );
f.setAttributes( dissolveAttrs );
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

QVariantMap outputs;
@@ -198,7 +198,8 @@ QVariantMap QgsCalculateVectorOverlapsAlgorithm::processAlgorithm( const QVarian
}

feature.setAttributes( outAttributes );
sink->addFeature( feature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( feature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

i++;
feedback->setProgress( i * step );
@@ -252,7 +252,8 @@ QVariantMap QgsCategorizeUsingStyleAlgorithm::processAlgorithm( const QVariantMa
{
QgsFeature f;
f.setAttributes( QgsAttributes() << cat.toString() );
nonMatchingCategoriesSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !nonMatchingCategoriesSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( nonMatchingCategoriesSink.get(), parameters, QStringLiteral( "NON_MATCHING_CATEGORIES" ) ) );
}
}
}
@@ -268,7 +269,8 @@ QVariantMap QgsCategorizeUsingStyleAlgorithm::processAlgorithm( const QVariantMa
{
QgsFeature f;
f.setAttributes( QgsAttributes() << name );
nonMatchingSymbolsSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !nonMatchingSymbolsSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( nonMatchingSymbolsSink.get(), parameters, QStringLiteral( "NON_MATCHING_SYMBOLS" ) ) );
}
}
}
@@ -214,7 +214,8 @@ QVariantMap QgsClipAlgorithm::processAlgorithm( const QVariantMap &parameters, Q
QgsFeature outputFeature;
outputFeature.setGeometry( newGeometry );
outputFeature.setAttributes( inputFeature.attributes() );
sink->addFeature( outputFeature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outputFeature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );


if ( singleClipFeature )
@@ -172,7 +172,8 @@ QVariantMap QgsDbscanClusteringAlgorithm::processAlgorithm( const QVariantMap &p
attr << QVariant() << QVariant();
}
feat.setAttributes( attr );
sink->addFeature( feat, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( feat, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

QVariantMap outputs;
@@ -181,7 +181,8 @@ QVariantMap QgsDeleteDuplicateGeometriesAlgorithm::processAlgorithm( const QVari
{
f.setGeometry( uniqueFeatures.value( f.id() ) );
}
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

current++;
feedback->setProgress( 0.10 * current * step + 90 ); // takes about 10% of time
@@ -375,13 +375,19 @@ QVariantMap QgsDetectVectorChangesAlgorithm::processAlgorithm( const QVariantMap
{
// unchanged
if ( unchangedSink )
unchangedSink->addFeature( f, QgsFeatureSink::FastInsert );
{
if ( !unchangedSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( unchangedSink.get(), parameters, QStringLiteral( "UNCHANGED" ) ) );
}
}
else
{
// deleted feature
if ( deletedSink )
deletedSink->addFeature( f, QgsFeatureSink::FastInsert );
{
if ( !deletedSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( deletedSink.get(), parameters, QStringLiteral( "DELETED" ) ) );
}
deleted++;
}

@@ -406,7 +412,8 @@ QVariantMap QgsDetectVectorChangesAlgorithm::processAlgorithm( const QVariantMap
break;

// added feature
addedSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !addedSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( addedSink.get(), parameters, QStringLiteral( "ADDED" ) ) );

current++;
feedback->setProgress( 0.10 * current * step + 90 ); // takes about 10% of time
@@ -84,7 +84,8 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
}

outputFeature.setGeometry( collector( geomQueue ) );
sink->addFeature( outputFeature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outputFeature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
else
{
@@ -146,7 +147,8 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
outputFeature.setGeometry( geom );
}
outputFeature.setAttributes( attrIt.value() );
sink->addFeature( outputFeature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outputFeature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

feedback->setProgress( current * 100.0 / numberFeatures );
current++;
@@ -173,7 +173,8 @@ QVariantMap QgsExplodeHstoreAlgorithm::processAlgorithm( const QVariantMap &para

outFeature.setGeometry( QgsGeometry( feat.geometry() ) );
outFeature.setAttributes( outAttributes );
sink->addFeature( outFeature, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outFeature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

QVariantMap outputs;
@@ -163,7 +163,8 @@ QVariantMap QgsExportLayersInformationAlgorithm::processAlgorithm( const QVarian
}
feature.setGeometry( QgsGeometry::fromRect( rect ) );
}
outputSink->addFeature( feature, QgsFeatureSink::FastInsert );
if ( !outputSink->addFeature( feature, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( outputSink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

QVariantMap outputs;
@@ -372,7 +372,8 @@ QVariantMap QgsExportMeshOnElement::processAlgorithm( const QVariantMap &paramet
feat.setGeometry( geom );
feat.setAttributes( attributes );

sink->addFeature( feat );
if ( !sink->addFeature( feat ) )
throw QgsProcessingException( writeFeatureError( sink, parameters, QStringLiteral( "OUTPUT" ) ) );

if ( feedback )
{
@@ -137,7 +137,8 @@ QVariantMap QgsExtentFromLayerAlgorithm::processAlgorithm( const QVariantMap &pa
QgsFeature feat;
feat.setGeometry( geom );
feat.setAttributes( QgsAttributes() << minX << minY << maxX << maxY << cntX << cntY << area << perim << height << width );
sink->addFeature( feat, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( feat, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

QVariantMap outputs;
outputs.insert( QStringLiteral( "OUTPUT" ), dest );
@@ -58,7 +58,8 @@ QVariantMap QgsExtentToLayerAlgorithm::processAlgorithm( const QVariantMap &para
QgsFeature f;
f.setAttributes( QgsAttributes() << 1 );
f.setGeometry( geom );
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

feedback->setProgress( 100 );

@@ -199,7 +199,8 @@ QVariantMap QgsExtractByAttributeAlgorithm::processAlgorithm( const QVariantMap
break;
}

matchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !matchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( matchingSink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

feedback->setProgress( current * step );
current++;
@@ -223,11 +224,13 @@ QVariantMap QgsExtractByAttributeAlgorithm::processAlgorithm( const QVariantMap
expressionContext.setFeature( f );
if ( expression.evaluate( &expressionContext ).toBool() )
{
matchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !matchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( matchingSink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
else
{
nonMatchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !nonMatchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( nonMatchingSink.get(), parameters, QStringLiteral( "FAIL_OUTPUT" ) ) );
}

feedback->setProgress( current * step );
@@ -116,7 +116,8 @@ QVariantMap QgsExtractByExpressionAlgorithm::processAlgorithm( const QVariantMap
break;
}

matchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !matchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( matchingSink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );

feedback->setProgress( current * step );
current++;
@@ -140,11 +141,13 @@ QVariantMap QgsExtractByExpressionAlgorithm::processAlgorithm( const QVariantMap
expressionContext.setFeature( f );
if ( expression.evaluate( &expressionContext ).toBool() )
{
matchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !matchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( matchingSink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
else
{
nonMatchingSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !nonMatchingSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( nonMatchingSink.get(), parameters, QStringLiteral( "FAIL_OUTPUT" ) ) );
}

feedback->setProgress( current * step );
@@ -106,7 +106,8 @@ QVariantMap QgsExtractByExtentAlgorithm::processAlgorithm( const QVariantMap &pa
f.setGeometry( g );
}

sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
feedback->setProgress( i * step );
}

@@ -507,7 +507,8 @@ QVariantMap QgsExtractByLocationAlgorithm::processAlgorithm( const QVariantMap &
auto addToSink = [&]( const QgsFeature & feature )
{
QgsFeature f = feature;
sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
};
process( context, input.get(), intersectSource.get(), selectedPredicates, addToSink, false, feedback );

@@ -151,7 +151,10 @@ QVariantMap QgsLayoutMapExtentToLayerAlgorithm::processAlgorithm( const QVariant
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

for ( QgsFeature &f : mFeatures )
sink->addFeature( f, QgsFeatureSink::FastInsert );
{
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}

feedback->setProgress( 100 );

@@ -122,7 +122,8 @@ QVariantMap QgsFilterAlgorithm::processAlgorithm( const QVariantMap &parameters,
{
if ( output->expression.evaluate( &expressionContext ).toBool() )
{
output->sink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !output->sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( output->sink.get(), parameters, output->name ) );
}
}

@@ -164,21 +164,24 @@ QVariantMap QgsFilterByGeometryAlgorithm::processAlgorithm( const QVariantMap &p
case QgsWkbTypes::PointGeometry:
if ( pointSink )
{
pointSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !pointSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( pointSink.get(), parameters, QStringLiteral( "POINTS" ) ) );
}
pointCount++;
break;
case QgsWkbTypes::LineGeometry:
if ( lineSink )
{
lineSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !lineSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( lineSink.get(), parameters, QStringLiteral( "LINES" ) ) );
}
lineCount++;
break;
case QgsWkbTypes::PolygonGeometry:
if ( polygonSink )
{
polygonSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !polygonSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( polygonSink.get(), parameters, QStringLiteral( "POLYGONS" ) ) );
}
polygonCount++;
break;
@@ -191,7 +194,8 @@ QVariantMap QgsFilterByGeometryAlgorithm::processAlgorithm( const QVariantMap &p
{
if ( noGeomSink )
{
noGeomSink->addFeature( f, QgsFeatureSink::FastInsert );
if ( !noGeomSink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( noGeomSink.get(), parameters, QStringLiteral( "NO_GEOMETRY" ) ) );
}
nullCount++;
}
@@ -144,7 +144,8 @@ QVariantMap QgsFlattenRelationshipsAlgorithm::processAlgorithm( const QVariantMa
attrs.append( relatedFeature.attributes() );
QgsFeature outFeat = feat;
outFeat.setAttributes( attrs );
sink->addFeature( outFeat, QgsFeatureSink::FastInsert );
if ( !sink->addFeature( outFeat, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
}
}

0 comments on commit 96f2cdb

Please sign in to comment.