Skip to content

Commit

Permalink
avoid crash on retrieval extent from invalid vector data providers
Browse files Browse the repository at this point in the history
(cherry picked from commit 6564da0)
  • Loading branch information
jef-n authored and nyalldawson committed Mar 7, 2019
1 parent 4eecfb9 commit 09c85cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Expand Up @@ -771,7 +771,7 @@ QgsRectangle QgsVectorLayer::extent() const
mLazyExtent = false;
}

if ( !mValidExtent && mLazyExtent && mDataProvider )
if ( !mValidExtent && mLazyExtent && mDataProvider && mDataProvider->isValid() )
{
// get the extent
QgsRectangle mbr = mDataProvider->extent();
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -3224,7 +3224,7 @@ bool QgsPostgresProvider::empty() const

QgsRectangle QgsPostgresProvider::extent() const
{
if ( mGeometryColumn.isNull() )
if ( !isValid() || mGeometryColumn.isNull() )
return QgsRectangle();

if ( mSpatialColType == SctGeography )
Expand Down

0 comments on commit 09c85cd

Please sign in to comment.