Skip to content

Commit

Permalink
Fix QGIS crash when removing a style from layer style panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Djedouas committed Apr 11, 2023
1 parent 6149d5d commit e3bfb25
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/gui/qgsmaplayerstylemanagerwidget.cpp
Expand Up @@ -168,21 +168,9 @@ void QgsMapLayerStyleManagerWidget::addStyle()
void QgsMapLayerStyleManagerWidget::removeStyle()
{
const QString current = mLayer->styleManager()->currentStyle();
const QList<QStandardItem *> items = mModel->findItems( current );
if ( items.isEmpty() )
return;

QStandardItem *item = items.at( 0 );
const bool res = mLayer->styleManager()->removeStyle( current );
if ( res )
{
mModel->removeRow( item->row() );
}
else
{
if ( !res )
QgsDebugMsg( QStringLiteral( "Failed to remove current style" ) );
}

}

void QgsMapLayerStyleManagerWidget::renameStyle( QStandardItem *item )
Expand Down

0 comments on commit e3bfb25

Please sign in to comment.