qgis/Quantum-GIS — pull request #789 by nyalldawson (2013-08-04 12:40:32+00:00)
Title: Fix bounding box calculation for features with NULL geometry (fixes #8192, #8194)

For features with NULL geometry,
qgsvectorlayer.cpp:1166:
fet.geometry->boundingBox()

is returning QgsRectangle(0,0,0,0). Combining this extent causes the bounding box min x and y to be set incorrectly to 0.

Instead, features with no geometry should not be considered when calculating the layer extent. I'm not sure that fet.geometry()->type() != QGis::UnknownGeometry is the best way to test for NULL geometry - please let me know if there's a better way and I'll update the request.

I've also changed the behaviour of QgsGeometry::boundingBox() to return a minimal QgsRectangle when no geometry is available, since it's possible that a valid point feature at 0,0 would have a bounding box of (0,0,0,0).