Fix crash in geometry collections with negative part numbers

This commit is contained in:
Nyall Dawson 2017-09-25 17:06:31 +10:00
parent b2bd0ac182
commit 0e908d5d5b

View File

@ -449,7 +449,7 @@ bool QgsGeometryCollection::insertVertex( QgsVertexId position, const QgsPoint &
bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &newPos ) bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &newPos )
{ {
if ( position.part >= mGeometries.size() ) if ( position.part < 0 || position.part >= mGeometries.size() )
{ {
return false; return false;
} }
@ -464,7 +464,7 @@ bool QgsGeometryCollection::moveVertex( QgsVertexId position, const QgsPoint &ne
bool QgsGeometryCollection::deleteVertex( QgsVertexId position ) bool QgsGeometryCollection::deleteVertex( QgsVertexId position )
{ {
if ( position.part >= mGeometries.size() ) if ( position.part < 0 || position.part >= mGeometries.size() )
{ {
return false; return false;
} }
@ -613,7 +613,7 @@ QgsAbstractGeometry *QgsGeometryCollection::segmentize( double tolerance, Segmen
double QgsGeometryCollection::vertexAngle( QgsVertexId vertex ) const double QgsGeometryCollection::vertexAngle( QgsVertexId vertex ) const
{ {
if ( vertex.part >= mGeometries.size() ) if ( vertex.part < 0 || vertex.part >= mGeometries.size() )
{ {
return 0.0; return 0.0;
} }