Skip to content

Commit

Permalink
Merge pull request #7211 from elpaso/bugfix-19145-legend-crash
Browse files Browse the repository at this point in the history
[bugfix] Do not crash when removing a layout legend item
  • Loading branch information
elpaso committed Jun 9, 2018
2 parents f4ecbbf + 137bc4d commit 2872665
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 2872665

Please sign in to comment.