Skip to content

Commit

Permalink
Fix crash when init a layer with invalid or not postgres data provide…
Browse files Browse the repository at this point in the history
…r and Refresh on Notify Enabled
  • Loading branch information
MorriganR authored and nyalldawson committed May 5, 2021
1 parent b7f990d commit c4346f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/qgsmaplayer.cpp
Expand Up @@ -2018,7 +2018,8 @@ bool QgsMapLayer::setDependencies( const QSet<QgsMapLayerDependency> &oDeps )
void QgsMapLayer::setRefreshOnNotifyEnabled( bool enabled )
{
QgsDataProvider *lDataProvider = dataProvider();
if ( !lDataProvider )

if ( !lDataProvider || !lDataProvider->isValid() || !( providerType() == QStringLiteral("postgres") ) )
return;

if ( enabled && !isRefreshOnNotifyEnabled() )
Expand Down

0 comments on commit c4346f9

Please sign in to comment.