Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[bugfix] Do not crash when removing a layout legend item
... when the layer was removed from the map, the legend
sync was disabled and the drawind order was enabled ...

Fixes #19145 Crash when deleting an item from the layout legend
  • Loading branch information
elpaso committed Jun 9, 2018
1 parent 2327728 commit 137bc4d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/layertree/qgslayertree.cpp
Expand Up @@ -138,6 +138,10 @@ void QgsLayerTree::writeXml( QDomElement &parentElement, const QgsReadWriteConte

Q_FOREACH ( QgsMapLayer *layer, mCustomLayerOrder )
{
// Safety belt, see https://issues.qgis.org/issues/19145
// Crash when deleting an item from the layout legend
if ( ! layer )
continue;
QDomElement layerElem = doc.createElement( QStringLiteral( "item" ) );
layerElem.appendChild( doc.createTextNode( layer->id() ) );
customOrderElem.appendChild( layerElem );
Expand Down

0 comments on commit 137bc4d

Please sign in to comment.