Skip to content

Commit

Permalink
Fix geometry collection can be corrupted by importing incorrect wkb
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 60f81bd commit 623a57a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/core/geometry/qgsgeometrycollection.cpp
Expand Up @@ -183,17 +183,6 @@ void QgsGeometryCollection::transform( const QTransform &t )
clearCache(); //set bounding box invalid
}

#if 0
void QgsGeometryCollection::clip( const QgsRectangle &rect )
{
QVector< QgsAbstractGeometry * >::iterator it = mGeometries.begin();
for ( ; it != mGeometries.end(); ++it )
{
( *it )->clip( rect );
}
}
#endif

void QgsGeometryCollection::draw( QPainter &p ) const
{
QVector< QgsAbstractGeometry * >::const_iterator it = mGeometries.constBegin();
Expand All @@ -210,7 +199,11 @@ bool QgsGeometryCollection::fromWkb( QgsConstWkbPtr &wkbPtr )
return false;
}

mWkbType = wkbPtr.readHeader();
QgsWkbTypes::Type wkbType = wkbPtr.readHeader();
if ( QgsWkbTypes::flatType( wkbType ) != QgsWkbTypes::flatType( mWkbType ) )
return false;

mWkbType = wkbType;

int nGeometries = 0;
wkbPtr >> nGeometries;
Expand Down

0 comments on commit 623a57a

Please sign in to comment.