Skip to content
Permalink
Browse files
Gui: fix crash when opening vector layer property dialog on a bad layer
  • Loading branch information
rouault committed Apr 10, 2021
1 parent c8b891b commit d7ba20b16cf97c908f2afd161659618e5c11de88
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/gui/vector/qgsvectorlayerproperties.cpp
@@ -944,7 +944,10 @@ void QgsVectorLayerProperties::loadDefaultStyle_clicked()
QString msg;
bool defaultLoadedFlag = false;

if ( mLayer->dataProvider()->isSaveAndLoadStyleToDatabaseSupported() )
const QgsVectorDataProvider *provider = mLayer->dataProvider();
if ( !provider )
return;
if ( provider->isSaveAndLoadStyleToDatabaseSupported() )
{
QMessageBox askToUser;
askToUser.setText( tr( "Load default style from: " ) );
@@ -999,7 +1002,10 @@ void QgsVectorLayerProperties::saveDefaultStyle_clicked()
{
apply();
QString errorMsg;
if ( mLayer->dataProvider()->isSaveAndLoadStyleToDatabaseSupported() )
const QgsVectorDataProvider *provider = mLayer->dataProvider();
if ( !provider )
return;
if ( provider->isSaveAndLoadStyleToDatabaseSupported() )
{
QMessageBox askToUser;
askToUser.setText( tr( "Save default style to: " ) );
@@ -1857,7 +1863,8 @@ void QgsVectorLayerProperties::optionsStackedWidget_CurrentChanged( int index )

void QgsVectorLayerProperties::mSimplifyDrawingGroupBox_toggled( bool checked )
{
if ( !( mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::SimplifyGeometries ) )
const QgsVectorDataProvider *provider = mLayer->dataProvider();
if ( !( provider && ( provider->capabilities() & QgsVectorDataProvider::SimplifyGeometries ) != 0 ) )
{
mSimplifyDrawingAtProvider->setEnabled( false );
}

0 comments on commit d7ba20b

Please sign in to comment.