Skip to content
Permalink
Browse files
Merge pull request #789 from nyalldawson/bug8192
Fix bounding box calculation for features with NULL geometry (fixes #8192, #8194)
  • Loading branch information
nyalldawson committed Aug 7, 2013
2 parents 020ed2c + 7608faf commit 6149b3a6fa15c0a5cd497c53269bd0f756c837e6
Showing with 5 additions and 2 deletions.
  1. +4 −1 src/core/qgsgeometry.cpp
  2. +1 −1 src/core/qgsvectorlayer.cpp
@@ -3607,7 +3607,10 @@ QgsRectangle QgsGeometry::boundingBox()
if ( !mGeometry )
{
QgsDebugMsg( "WKB geometry not available!" );
return QgsRectangle( 0, 0, 0, 0 );
// Return minimal QgsRectangle
QgsRectangle invalidRect;
invalidRect.setMinimal();
return invalidRect;
}

// consider endian when fetching feature type
@@ -1161,7 +1161,7 @@ QgsRectangle QgsVectorLayer::extent()
QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
if ( fet.geometry() )
if ( fet.geometry() && fet.geometry()->type() != QGis::UnknownGeometry )
{
QgsRectangle bb = fet.geometry()->boundingBox();
rect.combineExtentWith( &bb );

0 comments on commit 6149b3a

Please sign in to comment.