Skip to content

Commit

Permalink
Merge pull request #789 from nyalldawson/bug8192
Browse files Browse the repository at this point in the history
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 6149b3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 6149b3a

Please sign in to comment.