Skip to content
Permalink
Browse files

[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 137bc4dbc28f218757077f6a436a0210dc6c8f1f
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/layertree/qgslayertree.cpp
@@ -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 );

0 comments on commit 137bc4d

Please sign in to comment.
You can’t perform that action at this time.