Skip to content
Permalink
Browse files

avoid crash on retrieval extent from invalid vector data providers

(cherry picked from commit 6564da0)
  • Loading branch information
jef-n authored and nyalldawson committed Mar 7, 2019
1 parent 4eecfb9 commit 09c85cd157b6c9d4a9c132cf0ce7b84e72b8aedb
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/core/qgsvectorlayer.cpp
  2. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -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();
@@ -3224,7 +3224,7 @@ bool QgsPostgresProvider::empty() const

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

if ( mSpatialColType == SctGeography )

0 comments on commit 09c85cd

Please sign in to comment.
You can’t perform that action at this time.