Skip to content

Commit

Permalink
Null pointer check for the layer tree
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Sep 19, 2017
1 parent 0598be4 commit 388f863
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/layertree/qgslayertreemodellegendnode.cpp
Expand Up @@ -137,6 +137,7 @@ QgsSymbolLegendNode::QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const Qg
{
updateLabel();
connect( qobject_cast<QgsVectorLayer *>( nodeLayer->layer() ), &QgsVectorLayer::symbolFeatureCountMapChanged, this, &QgsSymbolLegendNode::updateLabel );
connect( nodeLayer, &QObject::destroyed, this, [ = ]() { mLayerNode = nullptr; } );

if ( mItem.symbol() )
mSymbolUsesMapUnits = ( mItem.symbol()->outputUnit() != QgsUnitTypes::RenderMillimeters );
Expand Down Expand Up @@ -444,6 +445,9 @@ void QgsSymbolLegendNode::invalidateMapBasedData()

void QgsSymbolLegendNode::updateLabel()
{
if ( !mLayerNode )
return;

bool showFeatureCount = mLayerNode->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toBool();
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mLayerNode->layer() );

Expand Down

0 comments on commit 388f863

Please sign in to comment.