Showing with 5 additions and 2 deletions.
  1. +4 −1 src/core/qgsgeometry.cpp
  2. +1 −1 src/core/qgsvectorlayer.cpp
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