Skip to content

Commit 0e908d5

Browse files
committedSep 25, 2017
Fix crash in geometry collections with negative part numbers
1 parent b2bd0ac commit 0e908d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/core/geometry/qgsgeometrycollection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPoint &
449449

450450
bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &newPos )
451451
{
452-
if ( position.part >= mGeometries.size() )
452+
if ( position.part < 0 || position.part >= mGeometries.size() )
453453
{
454454
return false;
455455
}
@@ -464,7 +464,7 @@ bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &ne
464464

465465
bool QgsGeometryCollection::deleteVertex( QgsVertexId position )
466466
{
467-
if ( position.part >= mGeometries.size() )
467+
if ( position.part < 0 || position.part >= mGeometries.size() )
468468
{
469469
return false;
470470
}
@@ -613,7 +613,7 @@ QgsAbstractGeometry *QgsGeometryCollection::segmentize( double tolerance, Segmen
613613

614614
double QgsGeometryCollection::vertexAngle( QgsVertexId vertex ) const
615615
{
616-
if ( vertex.part >= mGeometries.size() )
616+
if ( vertex.part < 0 || vertex.part >= mGeometries.size() )
617617
{
618618
return 0.0;
619619
}

0 commit comments

Comments
 (0)
Please sign in to comment.