Skip to content

Commit 6149b3a

Browse files
committed
Merge pull request #789 from nyalldawson/bug8192
Fix bounding box calculation for features with NULL geometry (fixes #8192, #8194)
2 parents 020ed2c + 7608faf commit 6149b3a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/core/qgsgeometry.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -3607,7 +3607,10 @@ QgsRectangle QgsGeometry::boundingBox()
36073607
if ( !mGeometry )
36083608
{
36093609
QgsDebugMsg( "WKB geometry not available!" );
3610-
return QgsRectangle( 0, 0, 0, 0 );
3610+
// Return minimal QgsRectangle
3611+
QgsRectangle invalidRect;
3612+
invalidRect.setMinimal();
3613+
return invalidRect;
36113614
}
36123615

36133616
// consider endian when fetching feature type

src/core/qgsvectorlayer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ QgsRectangle QgsVectorLayer::extent()
11611161
QgsFeature fet;
11621162
while ( fit.nextFeature( fet ) )
11631163
{
1164-
if ( fet.geometry() )
1164+
if ( fet.geometry() && fet.geometry()->type() != QGis::UnknownGeometry )
11651165
{
11661166
QgsRectangle bb = fet.geometry()->boundingBox();
11671167
rect.combineExtentWith( &bb );

0 commit comments

Comments
 (0)