Skip to content

Commit

Permalink
Fix broken delete ring tool (fix #12851)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 2, 2015
1 parent fab1a35 commit cde749f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/core/geometry/qgsgeometryeditutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int QgsGeometryEditUtils::addPart( QgsAbstractGeometryV2* geom, QgsAbstractGeome

bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometryV2* geom, int ringNum, int partNum )
{
if ( !geom )
if ( !geom || partNum < 0 )
{
return false;
}
Expand All @@ -147,14 +147,15 @@ bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometryV2* geom, int ringNum,
}

QgsAbstractGeometryV2* g = geom;
if ( partNum > 0 )
QgsGeometryCollectionV2* c = dynamic_cast<QgsGeometryCollectionV2*>( geom );
if ( c )
{
QgsMultiSurfaceV2* multiSurface = dynamic_cast<QgsMultiSurfaceV2*>( geom );
if ( !multiSurface )
{
return false;
}
g = multiSurface->geometryN( partNum );
g = c->geometryN( partNum );
}
else if ( partNum > 0 )
{
//part num specified, but not a multi part geometry type
return false;
}

QgsCurvePolygonV2* cpoly = dynamic_cast<QgsCurvePolygonV2*>( g );
Expand Down

0 comments on commit cde749f

Please sign in to comment.