Skip to content

Commit cde749f

Browse files
committedJun 2, 2015
Fix broken delete ring tool (fix #12851)
1 parent fab1a35 commit cde749f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
 

‎src/core/geometry/qgsgeometryeditutils.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int QgsGeometryEditUtils::addPart( QgsAbstractGeometryV2* geom, QgsAbstractGeome
136136

137137
bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometryV2* geom, int ringNum, int partNum )
138138
{
139-
if ( !geom )
139+
if ( !geom || partNum < 0 )
140140
{
141141
return false;
142142
}
@@ -147,14 +147,15 @@ bool QgsGeometryEditUtils::deleteRing( QgsAbstractGeometryV2* geom, int ringNum,
147147
}
148148

149149
QgsAbstractGeometryV2* g = geom;
150-
if ( partNum > 0 )
150+
QgsGeometryCollectionV2* c = dynamic_cast<QgsGeometryCollectionV2*>( geom );
151+
if ( c )
151152
{
152-
QgsMultiSurfaceV2* multiSurface = dynamic_cast<QgsMultiSurfaceV2*>( geom );
153-
if ( !multiSurface )
154-
{
155-
return false;
156-
}
157-
g = multiSurface->geometryN( partNum );
153+
g = c->geometryN( partNum );
154+
}
155+
else if ( partNum > 0 )
156+
{
157+
//part num specified, but not a multi part geometry type
158+
return false;
158159
}
159160

160161
QgsCurvePolygonV2* cpoly = dynamic_cast<QgsCurvePolygonV2*>( g );

0 commit comments

Comments
 (0)