Skip to content

Commit

Permalink
Fix crash in geometry collections with negative part numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent b2bd0ac commit 0e908d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/geometry/qgsgeometrycollection.cpp
Expand Up @@ -449,7 +449,7 @@ bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPoint &

bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &newPos )
{
if ( position.part >= mGeometries.size() )
if ( position.part < 0 || position.part >= mGeometries.size() )
{
return false;
}
Expand All @@ -464,7 +464,7 @@ bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &ne

bool QgsGeometryCollection::deleteVertex( QgsVertexId position )
{
if ( position.part >= mGeometries.size() )
if ( position.part < 0 || position.part >= mGeometries.size() )
{
return false;
}
Expand Down Expand Up @@ -613,7 +613,7 @@ QgsAbstractGeometry *QgsGeometryCollection::segmentize( double tolerance, Segmen

double QgsGeometryCollection::vertexAngle( QgsVertexId vertex ) const
{
if ( vertex.part >= mGeometries.size() )
if ( vertex.part < 0 || vertex.part >= mGeometries.size() )
{
return 0.0;
}
Expand Down

0 comments on commit 0e908d5

Please sign in to comment.