Handle if the selected layer is not a layer.

This commit is contained in:
Ismail Sunni 2022-02-18 21:38:28 +01:00 committed by Nyall Dawson
parent 5e68d9ab77
commit 57b50cae1d
2 changed files with 2 additions and 1 deletions

View File

@ -1288,7 +1288,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipBadLayers
connect( mMapStyleWidget, &QgsLayerStylingWidget::styleChanged, this, &QgisApp::updateLabelToolButtons );
connect( mMapStyleWidget, &QgsLayerStylingWidget::layerStyleChanged, this, [ = ]( QString styleName )
{
if ( !QgsMapLayerStyleManager::isDefault( styleName ) )
if ( !QgsMapLayerStyleManager::isDefault( styleName ) && styleName.size() != 0 )
{
mMapStylingDock->setWindowTitle( tr( "Layer Styling (%1)" ).arg( styleName ) );
}

View File

@ -168,6 +168,7 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
mStackedWidget->setCurrentIndex( mNotSupportedPage );
mLastStyleXml.clear();
mCurrentLayer = nullptr;
emitLayerStyleChanged( QString() );
return;
}