Skip to content
Permalink
Browse files

Fix incorrect logic in QgsGeometryDuplicateCheck

  • Loading branch information
nyalldawson committed Feb 5, 2021
1 parent 84d1d33 commit 3221e9c0fa8647c7a7e1c5c9fccd015409fc8c1d
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/analysis/vector/geometry_checker/qgsgeometryduplicatecheck.cpp
@@ -71,7 +71,7 @@ void QgsGeometryDuplicateCheck::collectErrors( const QMap<QString, QgsFeaturePoo
QString errMsg;
QgsGeometry geomB = layerFeatureB.geometry();
std::unique_ptr<QgsAbstractGeometry> diffGeom( geomEngineA->symDifference( geomB.constGet(), &errMsg ) );
if ( errMsg.isEmpty() && diffGeom && diffGeom->isEmpty() )
if ( errMsg.isEmpty() && ( !diffGeom || diffGeom->isEmpty() ) )
{
duplicates[layerFeatureB.layer()->id()].append( layerFeatureB.feature().id() );
}
@@ -121,14 +121,12 @@ void QgsGeometryDuplicateCheck::fixError( const QMap<QString, QgsFeaturePool *>
continue;
}
QgsGeometryCheckerUtils::LayerFeature layerFeatureB( featurePoolB, featureB, mContext, true );
QgsAbstractGeometry *diffGeom = geomEngineA->symDifference( layerFeatureB.geometry().constGet() );
if ( diffGeom && diffGeom->isEmpty() )
std::unique_ptr< QgsAbstractGeometry > diffGeom( geomEngineA->symDifference( layerFeatureB.geometry().constGet() ) );
if ( !diffGeom || diffGeom->isEmpty() )
{
featurePoolB->deleteFeature( featureB.id() );
changes[layerIdB][idB].append( Change( ChangeFeature, ChangeRemoved ) );
}

delete diffGeom;
}
}
error->setFixed( method );

0 comments on commit 3221e9c

Please sign in to comment.